fix: paste text instead of blocks when copied from another graph

Related to LOG-3123
This commit is contained in:
Tienson Qin
2024-06-05 21:51:08 +08:00
parent 23b6d0745a
commit 9c955081ab
3 changed files with 11 additions and 7 deletions

View File

@@ -179,13 +179,13 @@
[input text e html]
(util/stop e)
(->
(p/let [copied-blocks (get-copied-blocks)]
(if (seq copied-blocks)
(p/let [{:keys [graph blocks]} (get-copied-blocks)]
(if (and (seq blocks) (= graph (state/get-current-repo)))
;; Handle internal paste
(let [revert-cut-txs (get-revert-cut-txs copied-blocks)
(let [revert-cut-txs (get-revert-cut-txs blocks)
keep-uuid? (= (state/get-block-op-type) :cut)]
(editor-handler/paste-blocks copied-blocks {:revert-cut-txs revert-cut-txs
:keep-uuid? keep-uuid?}))
(editor-handler/paste-blocks blocks {:revert-cut-txs revert-cut-txs
:keep-uuid? keep-uuid?}))
(paste-copied-text input text html)))
(p/catch (fn [error]
(log/error :msg "Paste failed" :exception error)