tiptap: fix copy selection node

This commit is contained in:
fantasticit 2022-04-29 17:10:23 +08:00
parent cc3efef3f1
commit 473e2958c0
1 changed files with 0 additions and 13 deletions

View File

@ -148,21 +148,8 @@ export const Paste = Extension.create({
*/ */
if ((event.ctrlKey || event.metaKey) && event.keyCode == 67) { if ((event.ctrlKey || event.metaKey) && event.keyCode == 67) {
const { state } = view; const { state } = view;
const $pos = state.selection.$anchor;
// @ts-ignore // @ts-ignore
const currentNode = state.selection.node; const currentNode = state.selection.node;
let targetNode = null;
if (currentNode) {
targetNode = currentNode;
} else {
if ($pos.depth) {
for (let d = $pos.depth; d > 0; d--) {
const node = $pos.node(d);
targetNode = node;
}
}
}
if (currentNode) { if (currentNode) {
event.preventDefault(); event.preventDefault();