mirror of https://github.com/fantasticit/think.git
tiptap: hide drag handler in empty paragraph
This commit is contained in:
parent
87a863874d
commit
e41bbeec28
|
@ -147,17 +147,19 @@ export const Dragable = Extension.create({
|
||||||
const result = selectRootNodeByDom(dom, view);
|
const result = selectRootNodeByDom(dom, view);
|
||||||
activeNode = result;
|
activeNode = result;
|
||||||
|
|
||||||
if (!result) {
|
if (
|
||||||
|
!result ||
|
||||||
|
result.node.type.name === 'title' ||
|
||||||
|
result.node.type.name === 'tableOfContents' ||
|
||||||
|
// empty paragraph
|
||||||
|
(result.node.type.name === 'paragraph' && result.node.nodeSize === 2)
|
||||||
|
) {
|
||||||
if (dragging) return false;
|
if (dragging) return false;
|
||||||
hideDragHandleDOM();
|
hideDragHandleDOM();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.node.type.name === 'title') {
|
console.log(result);
|
||||||
if (dragging) return false;
|
|
||||||
hideDragHandleDOM();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderDragHandleDOM(view, result.el);
|
renderDragHandleDOM(view, result.el);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue