From dcd93a6685c26f9b9115415739dca1bf7d030734 Mon Sep 17 00:00:00 2001 From: Rodolpho Lima Date: Fri, 17 Mar 2023 14:49:40 +0000 Subject: [PATCH] [FIX] web_editor: hide powerbox category name when single one Powerbox commands are grouped under categories. But this is not very usefull when: - All commands are under of the same category - Each command is under a different category This commit hides the category name when all the commands passed to the powebox are under the same category. In order to avoid the second scenario, the commands array should be passed to `Powerbox.open()` with all commands having the same category name (the name does not matter), or even with `category` undefined. X-original-commit: 93d632861996c78502b33538cc7ff06d8419602c Part-of: odoo/odoo#118204 --- .../static/src/js/editor/odoo-editor/src/powerbox/Powerbox.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/powerbox/Powerbox.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/powerbox/Powerbox.js index c3285f2efa3..bdeb80a8e8e 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/powerbox/Powerbox.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/powerbox/Powerbox.js @@ -209,6 +209,10 @@ export class Powerbox { ); } } + // Hide category name if there is only a single one. + if (this._mainWrapperElement.childElementCount === 1) { + this._mainWrapperElement.querySelector('.oe-powerbox-category').style.display = 'none'; + } this._resetPosition(); } /**