fix: can't switch between modals by shortcuts

This commit is contained in:
Tienson Qin
2022-12-21 06:05:18 +08:00
parent b6abd05a97
commit 3a0fa79611
7 changed files with 35 additions and 34 deletions

View File

@@ -94,7 +94,6 @@
:ui/file-component nil
:ui/custom-query-components {}
:ui/show-recent? false
:ui/command-palette-open? false
:ui/developer-mode? (or (= (storage/get "developer-mode") "true")
false)
;; remember scroll positions of visited paths
@@ -1338,16 +1337,24 @@ Similar to re-frame subscriptions"
{:fullscreen? false
:close-btn? true}))
([modal-panel-content {:keys [id label fullscreen? close-btn? close-backdrop? center?]}]
(when (seq (get-sub-modals))
(close-sub-modal! true))
(swap! state assoc
:modal/id id
:modal/label (or label (if center? "ls-modal-align-center" ""))
:modal/show? (boolean modal-panel-content)
:modal/panel-content modal-panel-content
:modal/fullscreen? fullscreen?
:modal/close-btn? close-btn?
:modal/close-backdrop? (if (boolean? close-backdrop?) close-backdrop? true)) nil))
(let [opened? (modal-opened?)]
(when opened?
(close-modal!))
(when (seq (get-sub-modals))
(close-sub-modal! true))
(async/go
(when opened?
(<! (async/timeout 100)))
(swap! state assoc
:modal/id id
:modal/label (or label (if center? "ls-modal-align-center" ""))
:modal/show? (boolean modal-panel-content)
:modal/panel-content modal-panel-content
:modal/fullscreen? fullscreen?
:modal/close-btn? close-btn?
:modal/close-backdrop? (if (boolean? close-backdrop?) close-backdrop? true))))
nil))
(defn close-modal!
[]