From dab8827e3b3bee63d9453cd6beecf4d79e53a902 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Mon, 28 Feb 2022 09:08:44 +0100 Subject: [PATCH] [IMP] web_editor: page options activated on click on the customize tab With this commit, clicking on the "customize" tab automatically activates the page options (if there are any). This commit also replaces the name of the "style" tab by naming it "customize". task-2710582 --- .../static/src/js/editor/snippets.editor.js | 13 ++++++++++++- addons/web_editor/views/snippets.xml | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 8949108d944..36321199aa5 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2948,7 +2948,18 @@ var SnippetsMenu = Widget.extend({ if (!ev.currentTarget.classList.contains('active')) { this._activateSnippet(false); this._mutex.exec(() => { - this._activateEmptyOptionsTab(); + let $pageOptionsTarget = $(); + let i = 0; + const pageOptions = this.templateOptions.filter(template => template.data.pageOptions); + while (!$pageOptionsTarget.length && i < pageOptions.length) { + $pageOptionsTarget = pageOptions[i].selector.all(); + i++; + } + if ($pageOptionsTarget.length) { + this._activateSnippet($pageOptionsTarget); + } else { + this._activateEmptyOptionsTab(); + } }); } }, diff --git a/addons/web_editor/views/snippets.xml b/addons/web_editor/views/snippets.xml index 91e1c96c2a4..30c556138cb 100644 --- a/addons/web_editor/views/snippets.xml +++ b/addons/web_editor/views/snippets.xml @@ -18,7 +18,7 @@ Blocks