mirror of https://github.com/fantasticit/think.git
tiptap: prevent keyboard event in mind
This commit is contained in:
parent
2123dbbc32
commit
30815381ef
|
@ -1,5 +1,6 @@
|
||||||
import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
|
import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
|
||||||
import { ReactNodeViewRenderer } from '@tiptap/react';
|
import { ReactNodeViewRenderer } from '@tiptap/react';
|
||||||
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
||||||
import { MindWrapper } from 'tiptap/wrappers/mind';
|
import { MindWrapper } from 'tiptap/wrappers/mind';
|
||||||
import { getDatasetAttribute } from 'tiptap/prose-utils';
|
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;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue