From 3f9eb21571673ffb3eeab4d67b6e67c9ea571bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Wed, 7 Sep 2022 12:54:03 +0000 Subject: [PATCH] [FIX] web_editor: ensure correct set selection Ensure the selection is never put inside a contenteditable=false element when correcting the selection due to navigating around ZWS. Part-of: odoo/odoo#99460 --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index 50e757f6322..6799c384c69 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -3101,7 +3101,7 @@ export class OdooEditor extends EventTarget { // Move selection if next character is zero-width space if (nextCharacter === '\u200B') { focusOffset += 1; - while (focusNode && !focusNode.textContent[focusOffset]) { + while (focusNode && !focusNode.textContent[focusOffset] || !closestElement(focusNode).isContentEditable) { focusNode = nextLeaf(focusNode); focusOffset = 0; }