mirror of https://github.com/fantasticit/think.git
tiptap: fix copy selection node
This commit is contained in:
parent
cc3efef3f1
commit
473e2958c0
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue