tiptap: prevent keyboard event in mind

This commit is contained in:
fantasticit 2022-04-30 13:22:40 +08:00
parent 2123dbbc32
commit 30815381ef
1 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
import { ReactNodeViewRenderer } from '@tiptap/react';
import { Plugin, PluginKey } from 'prosemirror-state';
import { MindWrapper } from 'tiptap/wrappers/mind';
import { getDatasetAttribute } from 'tiptap/prose-utils';
@ -125,4 +126,21 @@ export const Mind = Node.create({
}),
];
},
addProseMirrorPlugins() {
const { editor } = this;
return [
new Plugin({
key: new PluginKey('mind'),
props: {
handleKeyDown(view, event) {
if (editor.isActive('mind')) {
return true;
}
},
},
}),
];
},
});