mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 17:36:33 +00:00
fix: clear shortcut listeners when unmount
Related to https://github.com/logseq/logseq/issues/572.
This commit is contained in:
@@ -229,11 +229,11 @@
|
||||
svg/outdent-block]
|
||||
[:button.bottom-action
|
||||
{:style {:padding "5px"}
|
||||
:on-click #(editor-handler/move-up-down parent-state % true)}
|
||||
:on-click #(editor-handler/move-up-down % true)}
|
||||
svg/move-up-block]
|
||||
[:button.bottom-action
|
||||
{:style {:padding "5px"}
|
||||
:on-click #(editor-handler/move-up-down parent-state % false)}
|
||||
:on-click #(editor-handler/move-up-down % false)}
|
||||
svg/move-down-block]
|
||||
[:button.bottom-action
|
||||
{:style {:padding "5px"}
|
||||
@@ -363,12 +363,6 @@
|
||||
*slash-caret-pos)))])
|
||||
|
||||
(rum/defcs box < rum/reactive
|
||||
(mixins/keyboard-mixin (util/->system-modifier "ctrl+shift+a") editor-handler/select-all-blocks!)
|
||||
(mixins/keyboard-mixin (if util/mac? "meta+shift+up" "alt+shift+up")
|
||||
(fn [state e]
|
||||
(editor-handler/move-up-down state e true)))
|
||||
(mixins/keyboard-mixin (if util/mac? "meta+shift+down" "alt+shift+down")
|
||||
(fn [state e] (editor-handler/move-up-down state e false)))
|
||||
(mixins/event-mixin
|
||||
(fn [state]
|
||||
(let [{:keys [id format block]} (get-state state)
|
||||
@@ -618,6 +612,8 @@
|
||||
{:did-mount (fn [state]
|
||||
(let [[{:keys [dummy? format block-parent-id]} id] (:rum/args state)
|
||||
content (get-in @state/state [:editor/content id])]
|
||||
(when block-parent-id
|
||||
(state/set-editing-block-dom-id! block-parent-id))
|
||||
(editor-handler/restore-cursor-pos! id content dummy?)
|
||||
|
||||
(when-let [input (gdom/getElement id)]
|
||||
@@ -683,7 +679,7 @@
|
||||
{:re-render-root? true}))))
|
||||
(editor-handler/save-block! (get-state state) value)))
|
||||
state)}
|
||||
[state {:keys [on-hide dummy? node format block]
|
||||
[state {:keys [on-hide dummy? node format block block-parent-id]
|
||||
:or {dummy? false}
|
||||
:as option} id config]
|
||||
(let [content (state/sub [:editor/content id])]
|
||||
|
||||
Reference in New Issue
Block a user