mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 03:16:37 +00:00
fix: disable shortcuts for rename dialog
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
[frontend.context.i18n :as i18n]
|
||||
[reitit.frontend.easy :as rfe]
|
||||
[frontend.text :as text]
|
||||
[frontend.modules.shortcut.core :as shortcut]
|
||||
[frontend.handler.block :as block-handler]))
|
||||
|
||||
(defn- get-page-name
|
||||
@@ -156,6 +157,7 @@
|
||||
(t :cancel)]]]])))
|
||||
|
||||
(rum/defcs rename-page-dialog-inner <
|
||||
(shortcut/disable-all-shortcuts)
|
||||
(rum/local "" ::input)
|
||||
[state title page-name close-fn]
|
||||
(let [input (get state ::input)]
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
install-id (medley/random-uuid)
|
||||
data {install-id
|
||||
{:group handler-id
|
||||
:dispath-fn f
|
||||
:dispatch-fn f
|
||||
:handler handler}}]
|
||||
|
||||
(events/listen handler EventType/SHORTCUT_TRIGGERED f)
|
||||
@@ -97,3 +97,22 @@
|
||||
(-> (get state :shortcut-key)
|
||||
uninstall-shortcut!)
|
||||
(dissoc state :shortcut-key))})
|
||||
|
||||
(defn unlisten-all []
|
||||
(doseq [{:keys [handler]} (vals @*installed)]
|
||||
(.removeAllListeners handler)))
|
||||
|
||||
(defn listen-all []
|
||||
(doseq [{:keys [handler dispatch-fn]} (vals @*installed)]
|
||||
(events/listen handler EventType/SHORTCUT_TRIGGERED dispatch-fn)))
|
||||
|
||||
(defn disable-all-shortcuts []
|
||||
{:did-mount
|
||||
(fn [state]
|
||||
(unlisten-all)
|
||||
state)
|
||||
|
||||
:will-unmount
|
||||
(fn [state]
|
||||
(listen-all)
|
||||
state)})
|
||||
|
||||
Reference in New Issue
Block a user