From cc82bad77513e415da8516f146be2778853df90e Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Wed, 19 Nov 2025 12:50:56 +0100 Subject: [PATCH] fix: disallow access to the `domElement` or `isFocused` if the editor is unmounted --- packages/core/src/editor/BlockNoteEditor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/editor/BlockNoteEditor.ts b/packages/core/src/editor/BlockNoteEditor.ts index 66f33cc65d..ed08960849 100644 --- a/packages/core/src/editor/BlockNoteEditor.ts +++ b/packages/core/src/editor/BlockNoteEditor.ts @@ -1082,10 +1082,16 @@ export class BlockNoteEditor< } public get domElement() { + if (this.headless) { + return undefined; + } return this.prosemirrorView?.dom as HTMLDivElement | undefined; } public isFocused() { + if (this.headless) { + return false; + } return this.prosemirrorView?.hasFocus() || false; } @@ -1673,7 +1679,7 @@ export class BlockNoteEditor< ignoreQueryLength?: boolean; }, ) { - if (!this.prosemirrorView) { + if (!this.prosemirrorView || this.headless) { return; }