From 5880e113508f11064c78f648bc5055f759e7bd9a Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 15 Aug 2022 13:20:32 +0800 Subject: [PATCH] enhance: close all existing modal when start editing --- src/main/frontend/mixins.cljs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/frontend/mixins.cljs b/src/main/frontend/mixins.cljs index cf1780698..64f6d97c4 100644 --- a/src/main/frontend/mixins.cljs +++ b/src/main/frontend/mixins.cljs @@ -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)