fix: pointerdown shouldn't edit a block from codemirror

This commit is contained in:
Tienson Qin
2024-06-05 18:35:25 +08:00
parent c871ca8a50
commit 644c04e8a1

View File

@@ -474,19 +474,17 @@
shifted?
(case key-code
"Enter"
(when-let [blockid (some-> (.-target e) (.closest "[blockid]") (.getAttribute "blockid"))]
(code-handler/save-code-editor!)
(js/setTimeout
(when-let [blockid (some-> (.-target e) (.closest "[blockid]") (.getAttribute "blockid"))]
(code-handler/save-code-editor!)
(js/setTimeout
#(editor-handler/api-insert-new-block! ""
{:block-uuid (uuid blockid)
:sibling? true}) 32))
{:block-uuid (uuid blockid)
:sibling? true}) 32))
nil)))))
(.addEventListener element "pointerdown"
(fn [e]
(.stopPropagation e)
(state/clear-selection!)
(when-let [block (and (:block/uuid config) (into {} (db/get-block-by-uuid (:block/uuid config))))]
(state/set-editing! id (.getValue editor) block nil {:move-cursor? false}))))
(state/clear-selection!)))
(.addEventListener element "touchstart"
(fn [e]
(.stopPropagation e)))