From 5cf51f3d26d126b47ad13a1fadd6968c38bff047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 10 Dec 2025 15:05:13 +0100 Subject: [PATCH] :bug: Fix text selection not being restore if it was only 1 word --- .../editor/controllers/SelectionController.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index 4c3af94dbc..2586aab148 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -504,19 +504,12 @@ export class SelectionController extends EventTarget { if (!this.#savedSelection) return false; if (this.#savedSelection.anchorNode && this.#savedSelection.focusNode) { - if (this.#savedSelection.anchorNode === this.#savedSelection.focusNode) { - this.#selection.setPosition( - this.#savedSelection.focusNode, - this.#savedSelection.focusOffset, - ); - } else { - this.#selection.setBaseAndExtent( - this.#savedSelection.anchorNode, - this.#savedSelection.anchorOffset, - this.#savedSelection.focusNode, - this.#savedSelection.focusOffset, - ); - } + this.#selection.setBaseAndExtent( + this.#savedSelection.anchorNode, + this.#savedSelection.anchorOffset, + this.#savedSelection.focusNode, + this.#savedSelection.focusOffset, + ); } this.#savedSelection = null; return true;