tiptap: fix bubble menu blur when editing some node

This commit is contained in:
fantasticit 2022-05-05 17:47:22 +08:00
parent b8a91a7d0c
commit 514873f31a
1 changed files with 12 additions and 4 deletions

View File

@ -11,11 +11,11 @@ export interface BubbleMenuPluginProps {
shouldShow?:
| ((props: {
editor: Editor;
view: EditorView;
state: EditorState;
view?: EditorView;
state?: EditorState;
oldState?: EditorState;
from: number;
to: number;
from?: number;
to?: number;
}) => boolean)
| null;
renderContainerSelector?: string;
@ -114,6 +114,14 @@ export class BubbleMenuView {
return;
}
const shouldShow =
this.editor.isEditable &&
this.shouldShow?.({
editor: this.editor,
});
if (shouldShow) return;
this.hide();
};