diff --git a/src/main/frontend/handler/events/ui.cljs b/src/main/frontend/handler/events/ui.cljs index 8202010165..9d9c5280aa 100644 --- a/src/main/frontend/handler/events/ui.cljs +++ b/src/main/frontend/handler/events/ui.cljs @@ -260,11 +260,16 @@ (defmethod events/handle :dialog-select/db-graph-replace [] (select/dialog-select! :db-graph-replace)) +(defn- hide-action-bar! + [] + (when (editor-handler/popup-exists? :selection-action-bar) + (shui/popup-hide! :selection-action-bar))) + (defmethod events/handle :editor/show-action-bar [] (let [selection (state/get-selection-blocks) first-visible-block (some #(when (util/el-visible-in-viewport? % true) %) selection)] (when first-visible-block - (shui/popup-hide! :selection-action-bar) + (hide-action-bar!) (shui/popup-show! first-visible-block (fn [] @@ -278,7 +283,7 @@ :align :start})))) (defmethod events/handle :editor/hide-action-bar [] - (shui/popup-hide! :selection-action-bar) + (hide-action-bar!) (state/set-state! :mobile/show-action-bar? false)) (defmethod events/handle :user/logout [[_]] diff --git a/src/main/frontend/ui.cljs b/src/main/frontend/ui.cljs index 38a836830b..17cafbd506 100644 --- a/src/main/frontend/ui.cljs +++ b/src/main/frontend/ui.cljs @@ -61,9 +61,11 @@ (some-> (shui-popup/get-last-popup) :content-props :class))) (defn hide-popups-until-preview-popup! [] - (while (and (shui-popups?) - (not (last-shui-preview-popup?))) - (shui/popup-hide!))) + (if (util/mobile?) + (shui/popup-hide!) + (while (and (shui-popups?) + (not (last-shui-preview-popup?))) + (shui/popup-hide!)))) (def built-in-colors ["yellow" diff --git a/src/main/mobile/components/popup.cljs b/src/main/mobile/components/popup.cljs index 64165c066c..3d73fbfa09 100644 --- a/src/main/mobile/components/popup.cljs +++ b/src/main/mobile/components/popup.cljs @@ -1,10 +1,10 @@ (ns mobile.components.popup "Mobile popup" - (:require [mobile.ionic :as ion] - [mobile.state :as mobile-state] - [dommy.core :as dom] + (:require [dommy.core :as dom] [logseq.shui.popup.core :as shui-popup] [logseq.shui.ui :as shui] + [mobile.ionic :as ion] + [mobile.state :as mobile-state] [rum.core :as rum])) (defonce *last-popup-modal? (atom nil)) @@ -56,7 +56,8 @@ #(.select (dom/sel1 "ion-tabs") "home") 1000)) :else - (when-not @*last-popup-modal? + (if @*last-popup-modal? + (mobile-state/set-popup! nil) (apply shui-popup/hide! args)))) (set! shui/popup-show! popup-show!)