fix js error

pull/238/head
fantasticit 2023-01-03 22:02:02 +08:00
parent 0fbdd1d11c
commit 107b8b759c
1 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,8 @@ export const Dragable = Extension.create({
name: 'dragable', name: 'dragable',
addProseMirrorPlugins() { addProseMirrorPlugins() {
if (!this.editor.isEditable) return [];
let editorView: EditorView; let editorView: EditorView;
let dragHandleDOM: HTMLElement; let dragHandleDOM: HTMLElement;
let activeNode: ActiveNode; let activeNode: ActiveNode;
@ -25,13 +27,13 @@ export const Dragable = Extension.create({
}; };
const showDragHandleDOM = () => { const showDragHandleDOM = () => {
dragHandleDOM.classList.add('show'); dragHandleDOM?.classList?.add('show');
dragHandleDOM.classList.remove('hide'); dragHandleDOM?.classList?.remove('hide');
}; };
const hideDragHandleDOM = () => { const hideDragHandleDOM = () => {
dragHandleDOM.classList.remove('show'); dragHandleDOM?.classList?.remove('show');
dragHandleDOM.classList.add('hide'); dragHandleDOM?.classList?.add('hide');
}; };
const renderDragHandleDOM = (view: EditorView, el: HTMLElement) => { const renderDragHandleDOM = (view: EditorView, el: HTMLElement) => {