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