enhance: close all existing modal when start editing

pull/6373/head
Tienson Qin 2022-08-15 13:20:32 +08:00
parent 982e8e1b8a
commit 5880e11350
1 changed files with 8 additions and 8 deletions

View File

@ -55,14 +55,14 @@
(try
(let [dom-node (rum/dom-node state)]
(when-let [dom-node (or node dom-node)]
(or (false? outside?)
(listen state js/window "mousedown"
(fn [e]
(let [target (.. e -target)]
;; If the click target is outside of current node
(when (and (not (dom/contains dom-node target))
(not (.contains (.-classList target) "ignore-outside-event")))
(on-hide state e :click))))))
(let [click-fn (fn [e]
(let [target (.. e -target)]
;; If the click target is outside of current node
(when (and (not (dom/contains dom-node target))
(not (.contains (.-classList target) "ignore-outside-event")))
(on-hide state e :click))))]
(when-not (false? outside?)
(listen state js/window "mouseup" click-fn)))
(listen state js/window "keydown"
(fn [e]
(case (.-keyCode e)