fix: can't undo on CodeMirror blocks

This commit is contained in:
Tienson Qin
2023-04-24 17:14:44 +08:00
parent ab0c1c1860
commit 0b6cb1f20f
2 changed files with 6 additions and 17 deletions

View File

@@ -552,8 +552,7 @@
:shortcut.handler/editor-global :shortcut.handler/editor-global
(-> (->
(build-category-map [ (build-category-map [:graph/export-as-html
:graph/export-as-html
:graph/open :graph/open
:graph/remove :graph/remove
:graph/add :graph/add
@@ -580,7 +579,9 @@
:editor/copy :editor/copy
:editor/copy-text :editor/copy-text
:editor/cut :editor/cut
:command/toggle-favorite]) :command/toggle-favorite
:editor/undo
:editor/redo])
(with-meta {:before m/enable-when-not-component-editing!})) (with-meta {:before m/enable-when-not-component-editing!}))
:shortcut.handler/global-prevent-default :shortcut.handler/global-prevent-default
@@ -590,8 +591,7 @@
:editor/zoom-in :editor/zoom-in
:editor/zoom-out :editor/zoom-out
:editor/toggle-undo-redo-mode :editor/toggle-undo-redo-mode
:editor/undo
:editor/redo
:ui/toggle-brackets :ui/toggle-brackets
:go/search-in-page :go/search-in-page
:go/search :go/search

View File

@@ -1560,12 +1560,6 @@ Similar to re-frame subscriptions"
(when-let [tldraw-el (.querySelector js/document.body ".logseq-tldraw[data-tlapp]")] (when-let [tldraw-el (.querySelector js/document.body ".logseq-tldraw[data-tlapp]")]
(gobj/get js/window.tlapps (.. tldraw-el -dataset -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? (defn set-graph-syncing?
[value] [value]
(set-state! :graph/syncing? value)) (set-state! :graph/syncing? value))
@@ -1737,14 +1731,9 @@ Similar to re-frame subscriptions"
[args] [args]
(set-state! :editor/args args)) (set-state! :editor/args args))
(defn editing-whiteboard-portal?
[]
(and (active-tldraw-app) (tldraw-editing-logseq-block?)))
(defn block-component-editing? (defn block-component-editing?
[] []
(and (:block/component-editing-mode? @state) (:block/component-editing-mode? @state))
(not (editing-whiteboard-portal?))))
(defn set-block-component-editing-mode! (defn set-block-component-editing-mode!
[value] [value]