From 0b6cb1f20fff52aeabb8fa4fdbb98e506487abe1 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 24 Apr 2023 17:14:44 +0800 Subject: [PATCH] fix: can't undo on CodeMirror blocks --- src/main/frontend/modules/shortcut/config.cljs | 10 +++++----- src/main/frontend/state.cljs | 13 +------------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/main/frontend/modules/shortcut/config.cljs b/src/main/frontend/modules/shortcut/config.cljs index 0e11bcc2cb..a7050f47c7 100644 --- a/src/main/frontend/modules/shortcut/config.cljs +++ b/src/main/frontend/modules/shortcut/config.cljs @@ -552,8 +552,7 @@ :shortcut.handler/editor-global (-> - (build-category-map [ - :graph/export-as-html + (build-category-map [:graph/export-as-html :graph/open :graph/remove :graph/add @@ -580,7 +579,9 @@ :editor/copy :editor/copy-text :editor/cut - :command/toggle-favorite]) + :command/toggle-favorite + :editor/undo + :editor/redo]) (with-meta {:before m/enable-when-not-component-editing!})) :shortcut.handler/global-prevent-default @@ -590,8 +591,7 @@ :editor/zoom-in :editor/zoom-out :editor/toggle-undo-redo-mode - :editor/undo - :editor/redo + :ui/toggle-brackets :go/search-in-page :go/search diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index 91f3ff68bb..dea74b1077 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -1560,12 +1560,6 @@ Similar to re-frame subscriptions" (when-let [tldraw-el (.querySelector js/document.body ".logseq-tldraw[data-tlapp]")] (gobj/get js/window.tlapps (.. tldraw-el -dataset -tlapp)))) -(defn tldraw-editing-logseq-block? - [] - (when-let [app (active-tldraw-app)] - (and (= 1 (.. app -selectedShapesArray -length)) - (= (.. app -editingShape) (.. app -selectedShapesArray (at 0)))))) - (defn set-graph-syncing? [value] (set-state! :graph/syncing? value)) @@ -1737,14 +1731,9 @@ Similar to re-frame subscriptions" [args] (set-state! :editor/args args)) -(defn editing-whiteboard-portal? - [] - (and (active-tldraw-app) (tldraw-editing-logseq-block?))) - (defn block-component-editing? [] - (and (:block/component-editing-mode? @state) - (not (editing-whiteboard-portal?)))) + (:block/component-editing-mode? @state)) (defn set-block-component-editing-mode! [value]