mirror of https://github.com/fantasticit/think.git
Merge pull request #151 from fantasticit/fix/drag
This commit is contained in:
commit
3c11bfc121
|
@ -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;
|
||||||
|
|
|
@ -2,6 +2,5 @@ import { mergeAttributes } from '@tiptap/core';
|
||||||
import TitapParagraph from '@tiptap/extension-paragraph';
|
import TitapParagraph from '@tiptap/extension-paragraph';
|
||||||
|
|
||||||
export const Paragraph = TitapParagraph.extend({
|
export const Paragraph = TitapParagraph.extend({
|
||||||
draggable: true,
|
|
||||||
selectable: true,
|
selectable: true,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue