Browse Source

chore: remove unused code

Tienson Qin 3 years ago
parent
commit
a3cd3444ec
2 changed files with 7 additions and 8 deletions
  1. 4 1
      src/main/frontend/core.cljs
  2. 3 7
      src/main/frontend/modules/shortcut/core.cljs

+ 4 - 1
src/main/frontend/core.cljs

@@ -14,7 +14,8 @@
             [logseq.api]
             [frontend.fs.sync :as sync]
             [frontend.config :as config]
-            [frontend.util :as util]))
+            [frontend.util :as util]
+            [frontend.modules.shortcut.core :as shortcut]))
 
 (defn set-router!
   []
@@ -47,6 +48,7 @@
   (when-let [node (.getElementById js/document "root")]
     (set-router!)
     (rum/mount (page/current-page) node)
+    (shortcut/refresh!)
     (display-welcome-message)
     (persist-var/load-vars)
     (when (and config/dev? (util/electron?))
@@ -71,5 +73,6 @@
   ;; this is controlled by :before-load in the config
   (handler/stop!)
   (when (and config/dev? (util/electron?))
+
     (sync/<sync-stop))
   (js/console.log "stop"))

+ 3 - 7
src/main/frontend/modules/shortcut/core.cljs

@@ -93,13 +93,10 @@
 (defn install-shortcut!
   [handler-id {:keys [set-global-keys?
                       prevent-default?
-                      skip-installed?
                       state]
                :or   {set-global-keys? true
-                      prevent-default? false
-                      skip-installed? false}}]
-  (when-let [install-id (ffirst (filter (fn [[id m]]
-                                          (= handler-id (:group m))) @*installed))]
+                      prevent-default? false}}]
+  (when-let [install-id (get-handler-by-id handler-id)]
     (uninstall-shortcut! install-id))
 
   (let [shortcut-map (dh/shortcut-map handler-id state)
@@ -128,8 +125,7 @@
 
       (.listen handler EventType/SHORTCUT_TRIGGERED f)
 
-      (when-not skip-installed?
-        (swap! *installed merge data))
+      (swap! *installed merge data)
 
       install-id)))