enhance: reload commands when toggle any plugin

pull/3068/head
Tienson Qin 2021-11-04 17:53:57 +08:00
parent 78eb7718ed
commit 179a8de37e
2 changed files with 4 additions and 12 deletions

View File

@ -12,6 +12,7 @@
[frontend.components.svg :as svg]
[frontend.handler.notification :as notification]
[frontend.handler.plugin :as plugin-handler]
[frontend.handler.page :as page-handler]
[clojure.string :as string]))
(rum/defcs installed-themes
@ -248,7 +249,8 @@
(ui/toggle (not disabled)
(fn []
(js-invoke js/LSPluginCore (if disabled "enable" "disable") id))
(js-invoke js/LSPluginCore (if disabled "enable" "disable") id)
(page-handler/init-commands!))
true)]])]])))
(rum/defcs marketplace-plugins
@ -428,4 +430,4 @@
(or (not util/nfs?) nfs-granted?))
(ui-handler/exec-js-if-exists-&-allowed! t)))
[current-repo db-restoring? nfs-granted?])
nil)
nil)

View File

@ -652,13 +652,3 @@
(defn open-file-in-directory []
(when-let [file-path (and (util/electron?) (get-page-file-path))]
(js/window.apis.showItemInFolder file-path)))
;; Commander
(defonce *slash-commander-watcher? (atom false))
(when-not @*slash-commander-watcher?
(add-watch commands/*show-commands :slash-commander-watcher
(fn [_ _ old-state new-state]
(when (and (not old-state) new-state)
(init-commands!))))
(reset! *slash-commander-watcher? true))