fix: editor ready check

This commit is contained in:
Philipinho
2026-05-14 18:40:03 +01:00
parent 5c5fff517c
commit d524073d86
11 changed files with 32 additions and 15 deletions
+9
View File
@@ -338,6 +338,15 @@ export const isRowGripSelected = ({
return !!gripRow;
};
// TipTap's `editor.view` proxy throws if accessed before mount or after destroy.
// Guard floating-menu callbacks (getReferencedVirtualElement, shouldShow) with
// this before touching `editor.view.nodeDOM(...)`.
export function isEditorReady(
editor: Editor | null | undefined,
): editor is Editor {
return !!editor && editor.isInitialized;
}
export function isTextSelected(editor: Editor) {
const {
state: {