mirror of https://github.com/logseq/logseq
enhance: close all existing modal when start editing
parent
982e8e1b8a
commit
5880e11350
|
@ -55,14 +55,14 @@
|
||||||
(try
|
(try
|
||||||
(let [dom-node (rum/dom-node state)]
|
(let [dom-node (rum/dom-node state)]
|
||||||
(when-let [dom-node (or node dom-node)]
|
(when-let [dom-node (or node dom-node)]
|
||||||
(or (false? outside?)
|
(let [click-fn (fn [e]
|
||||||
(listen state js/window "mousedown"
|
(let [target (.. e -target)]
|
||||||
(fn [e]
|
;; If the click target is outside of current node
|
||||||
(let [target (.. e -target)]
|
(when (and (not (dom/contains dom-node target))
|
||||||
;; If the click target is outside of current node
|
(not (.contains (.-classList target) "ignore-outside-event")))
|
||||||
(when (and (not (dom/contains dom-node target))
|
(on-hide state e :click))))]
|
||||||
(not (.contains (.-classList target) "ignore-outside-event")))
|
(when-not (false? outside?)
|
||||||
(on-hide state e :click))))))
|
(listen state js/window "mouseup" click-fn)))
|
||||||
(listen state js/window "keydown"
|
(listen state js/window "keydown"
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(case (.-keyCode e)
|
(case (.-keyCode e)
|
||||||
|
|
Loading…
Reference in New Issue