From 98073c3bb0988f9b5940a9cce18edf0d9e69a9fe Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Thu, 6 Jan 2022 12:39:28 +0000 Subject: [PATCH] [FIX] web_editor: prevent editor powerbox hint duplication Whenever the browser is lagging between multiple enter, the command hints were not being updated until the browser main thread process the event queue. Task-2728794 closes odoo/odoo#85935 X-original-commit: 8525f6ea677e89a932c783545c1d9dcf9b4d175a Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index 68a342a0e50..f184f6ef7fd 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -1499,6 +1499,7 @@ export class OdooEditor extends EventTarget { const result = this._protect(() => this._applyRawCommand(...args)); this.sanitize(); this.historyStep(); + this._handleCommandHint(); return result; } /** @@ -2401,6 +2402,9 @@ export class OdooEditor extends EventTarget { this.observerUnactive(); for (const hint of this.editable.querySelectorAll('.oe-hint')) { hint.classList.remove('oe-hint', 'oe-command-temporary-hint'); + if (hint.classList.length === 0) { + hint.removeAttribute('class'); + } hint.removeAttribute('placeholder'); } this.cleanForSave(); @@ -2483,6 +2487,9 @@ export class OdooEditor extends EventTarget { if (hint.classList.contains('oe-command-temporary-hint') || !isEmptyBlock(hint)) { this.observerUnactive(); hint.classList.remove('oe-hint', 'oe-command-temporary-hint'); + if (hint.classList.length === 0) { + hint.removeAttribute('class'); + } hint.removeAttribute('placeholder'); this.observerActive(); }