Browse Source

fix(ui): exit edit mode when prompt

Fix #4359
Andelf 3 years ago
parent
commit
ec75142730
1 changed files with 15 additions and 5 deletions
  1. 15 5
      src/main/frontend/modules/shortcut/config.cljs

+ 15 - 5
src/main/frontend/modules/shortcut/config.cljs

@@ -276,11 +276,15 @@
 
    :go/search-in-page              {:desc    "Search in the current page"
                                     :binding "mod+shift+k"
-                                    :fn      #(route-handler/go-to-search! :page)}
+                                    :fn      #(do
+                                                (editor-handler/escape-editing)
+                                                (route-handler/go-to-search! :page))}
 
    :go/search                      {:desc    "Full text search"
                                     :binding "mod+k"
-                                    :fn      #(route-handler/go-to-search! :global)}
+                                    :fn      #(do
+                                                (editor-handler/escape-editing)
+                                                (route-handler/go-to-search! :global))}
 
    :go/journals                    {:desc    "Go to journals"
                                     :binding "g j"
@@ -313,14 +317,20 @@
 
    :command-palette/toggle         {:desc    "Toggle command palette"
                                     :binding "mod+shift+p"
-                                    :fn      (fn [] (state/toggle! :ui/command-palette-open?))}
+                                    :fn      #(do
+                                                (editor-handler/escape-editing)
+                                                (state/toggle! :ui/command-palette-open?))}
 
    :graph/open                     {:desc    "Select graph to open"
-                                    :fn      (fn [] (state/set-state! :ui/open-select :graph-open))
+                                    :fn      #(do
+                                                (editor-handler/escape-editing)
+                                                (state/set-state! :ui/open-select :graph-open))
                                     :binding "mod+shift+g"}
 
    :graph/remove                   {:desc    "Remove a graph"
-                                    :fn      (fn [] (state/set-state! :ui/open-select :graph-remove))
+                                    :fn      #(do
+                                                (editor-handler/escape-editing)
+                                                (state/set-state! :ui/open-select :graph-remove))
                                     :binding false}
 
    :graph/add                      {:desc "Add a graph"