From dbf87fec6883143bd164d8d05a0d0a725f42537a Mon Sep 17 00:00:00 2001 From: fantasticit Date: Mon, 15 Aug 2022 11:08:22 +0800 Subject: [PATCH] tiptap: hide drag handler in topNode --- packages/client/src/tiptap/core/extensions/dragable.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client/src/tiptap/core/extensions/dragable.ts b/packages/client/src/tiptap/core/extensions/dragable.ts index 2278960..e418483 100644 --- a/packages/client/src/tiptap/core/extensions/dragable.ts +++ b/packages/client/src/tiptap/core/extensions/dragable.ts @@ -145,10 +145,11 @@ export const Dragable = Extension.create({ } const result = selectRootNodeByDom(dom, view); - activeNode = result; if ( !result || + result.node.type.name === 'doc' || + result.node.type.name === 'documentWithTitle' || result.node.type.name === 'title' || result.node.type.name === 'tableOfContents' || // empty paragraph @@ -159,6 +160,8 @@ export const Dragable = Extension.create({ return false; } + activeNode = result; + renderDragHandleDOM(view, result.el); return false; },