mirror of https://github.com/logseq/logseq
Fix selection for referenced blocks
parent
d558a6bc4c
commit
5885529120
|
@ -127,21 +127,6 @@
|
|||
(js/setTimeout #(state/set-selection-blocks! blocks)
|
||||
200)))))))
|
||||
|
||||
(mixins/listen state js/window "click"
|
||||
(fn [e]
|
||||
;; hide context menu
|
||||
(state/hide-custom-context-menu!)
|
||||
|
||||
;; enable scroll
|
||||
(let [main (d/by-id "main-content")]
|
||||
(d/remove-class! main "overflow-hidden")
|
||||
(d/add-class! main "overflow-y-auto"))
|
||||
|
||||
(when-not (state/get-selection-start-block)
|
||||
(editor-handler/clear-selection! e))
|
||||
|
||||
(state/set-selection-start-block! nil)))
|
||||
|
||||
(mixins/listen state js/window "contextmenu"
|
||||
(fn [e]
|
||||
(let [target (gobj/get e "target")
|
||||
|
|
|
@ -1027,7 +1027,7 @@
|
|||
(when (and
|
||||
(not (state/get-selection-start-block))
|
||||
(= (gobj/get e "buttons") 1))
|
||||
(state/set-selection-start-block! block-id)))
|
||||
(when block-id (state/set-selection-start-block! block-id))))
|
||||
:on-mouse-over (fn [e]
|
||||
(util/stop e)
|
||||
(when has-child?
|
||||
|
|
|
@ -131,6 +131,19 @@
|
|||
;; TODO: move this to keyboards
|
||||
(mixins/event-mixin
|
||||
(fn [state]
|
||||
(mixins/listen state js/window "click"
|
||||
(fn [e]
|
||||
;; hide context menu
|
||||
(state/hide-custom-context-menu!)
|
||||
|
||||
;; enable scroll
|
||||
(let [main (d/by-id "main-content")]
|
||||
(d/remove-class! main "overflow-hidden")
|
||||
(d/add-class! main "overflow-y-auto"))
|
||||
(if-not (state/get-selection-start-block)
|
||||
(editor-handler/clear-selection! e)
|
||||
(state/set-selection-start-block! nil))))
|
||||
|
||||
(mixins/on-key-down
|
||||
state
|
||||
{
|
||||
|
|
|
@ -319,12 +319,6 @@
|
|||
[]
|
||||
(get @state :selection/start-block))
|
||||
|
||||
(defn clear-selection-region!
|
||||
[]
|
||||
(swap! state assoc
|
||||
:selection/start-block nil
|
||||
:selection/end-block nil))
|
||||
|
||||
(defn set-selection-blocks!
|
||||
[blocks]
|
||||
(when (seq blocks)
|
||||
|
|
Loading…
Reference in New Issue