From efd4a3f7c2f16cf0e92f01f7d539b277c65972fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Fri, 7 Oct 2022 07:55:58 +0000 Subject: [PATCH] [FIX] web_editor: fix wysiwyg focus Ensure the wysiwyg.js focus() method will actually restore the cursor in the latest selection inside the editor. X-original-commit: 54877ecd8bf2454a7023e74aa739921e1468dad8 Part-of: odoo/odoo#102603 --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 4 +++- 1 file changed, 3 insertions(+), 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 c94e7c6592e..76e5666e961 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 @@ -1238,8 +1238,10 @@ export class OdooEditor extends EventTarget { focusNode, computedSelection.focusOffset, ); + return true; } } + return false; } historySetSelection(step) { this.deselectTable(); @@ -2400,7 +2402,7 @@ export class OdooEditor extends EventTarget { focusNode: sel.focusNode, focusOffset: sel.focusOffset, }; - if (!sel.isCollapsed && this.isSelectionInEditable(sel)) { + if (this.isSelectionInEditable(sel)) { this._latestComputedSelectionInEditable = this._latestComputedSelection; } return this._latestComputedSelection;