Browse Source

fix: stop event bubbling when typing `s` to switch file/outliner view

Tienson Qin 4 years ago
parent
commit
56be5a68ba
2 changed files with 4 additions and 4 deletions
  1. 1 1
      src/main/frontend/handler/route.cljs
  2. 3 3
      src/main/frontend/keyboards.cljs

+ 1 - 1
src/main/frontend/handler/route.cljs

@@ -109,7 +109,7 @@
                 :path-params {:path path}})))
 
 (defn toggle-between-page-and-file!
-  []
+  [state e]
   (let [current-route (state/get-current-route)]
     (case current-route
       :home

+ 3 - 3
src/main/frontend/keyboards.cljs

@@ -80,8 +80,8 @@
 
 (defn chord-aux
   [f]
-  (fn [_state _e]
-    (f)
+  (fn [state e]
+    (f state e)
     ;; return false to prevent default browser behavior
     ;; and stop event from bubbling
     false))
@@ -92,7 +92,7 @@
    "t t" state/toggle-theme!
    "t r" ui-handler/toggle-right-sidebar!
    "t e" state/toggle-new-block-shortcut!
-   "s" route-handler/toggle-between-page-and-file!
+   "s" (chord-aux route-handler/toggle-between-page-and-file!)
    "mod+s" (chord-aux editor-handler/save!)
    "mod+c mod+s" (chord-aux search-handler/rebuild-indices!)
    "mod+c mod+b" (chord-aux config-handler/toggle-ui-show-brackets!)})