From 3be1ae2ac1b767c52c0ee2cead726abf21163dbe Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 27 Mar 2026 07:24:03 +0000 Subject: [PATCH] :bug: Guard against null focusNode/anchorNode in text-editor --- .../src/editor/controllers/SelectionController.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index d647e6a948..d5c5ad7db4 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -961,7 +961,7 @@ export class SelectionController extends EventTarget { * @type {boolean} */ get isTextFocus() { - return this.focusNode.nodeType === Node.TEXT_NODE; + return this.focusNode != null && this.focusNode.nodeType === Node.TEXT_NODE; } /** @@ -970,7 +970,9 @@ export class SelectionController extends EventTarget { * @type {boolean} */ get isTextAnchor() { - return this.anchorNode.nodeType === Node.TEXT_NODE; + return ( + this.anchorNode != null && this.anchorNode.nodeType === Node.TEXT_NODE + ); } /**