Skip to content

Commit 28cddaa

Browse files
authored
fix: disallow access to the domElement or isFocused if the editor is unmounted (#2187)
1 parent fbf3285 commit 28cddaa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,16 @@ export class BlockNoteEditor<
10821082
}
10831083

10841084
public get domElement() {
1085+
if (this.headless) {
1086+
return undefined;
1087+
}
10851088
return this.prosemirrorView?.dom as HTMLDivElement | undefined;
10861089
}
10871090

10881091
public isFocused() {
1092+
if (this.headless) {
1093+
return false;
1094+
}
10891095
return this.prosemirrorView?.hasFocus() || false;
10901096
}
10911097

@@ -1673,7 +1679,7 @@ export class BlockNoteEditor<
16731679
ignoreQueryLength?: boolean;
16741680
},
16751681
) {
1676-
if (!this.prosemirrorView) {
1682+
if (!this.prosemirrorView || this.headless) {
16771683
return;
16781684
}
16791685

0 commit comments

Comments
 (0)