From 1aad11b0bfd728385c5bb3972e201790a680bcaf Mon Sep 17 00:00:00 2001 From: aath-odoo Date: Mon, 14 Nov 2022 12:52:28 +0000 Subject: [PATCH] [FIX] web_editor: command prompt not displaying on focus Before this commit: command prompt is not displayed when html field has placeholder. After this commit: placeholder is replaced with command prompt when focused. Task-2881079 closes odoo/odoo#108175 X-original-commit: 16cb4af921fec5483e366ea0a1b402631a7e28f3 Signed-off-by: David Monjoie (dmo) --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 3 ++- 1 file changed, 2 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 e475097e76c..062cdd76500 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 @@ -3829,7 +3829,8 @@ export class OdooEditor extends EventTarget { } // placeholder hint - if (this.editable.textContent === '' && this.options.placeholder && this.editable.firstChild && this.editable.firstChild.innerHTML) { + const sel = this.document.getSelection(); + if (this.editable.textContent.trim() === '' && this.options.placeholder && this.editable.firstChild && this.editable.firstChild.innerHTML && !this.editable.contains(sel.focusNode)) { this._makeHint(this.editable.firstChild, this.options.placeholder, true); } }