diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-05-28 10:04:22 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-05-28 14:32:25 +0000 |
| commit | e2cf0a235810c1773bac68592a0dce9a67adbc34 (patch) | |
| tree | c79b10678f490f42a43f915707cf53bad8eaed66 /addons/website/static/src/js | |
| parent | 0c895e0bf9c402fc109e49d063702544b58eb0b4 (diff) | |
[FIX] website, *: review theme tab creation + switching
*: web_editor
When clicking on the theme tab on an empty page, a scrollbar appeared
and stayed. This was because the fake `<theme/>` element was focused and
the overlay positioned randomly outside of the page.
This commit fixes that by simplifying the code and always hiding the
related overlay. This commit also makes sure the onFocus/onBlur method
of the theme options are called consistently, even though they are
probably not useful.
Part of https://github.com/odoo/odoo/pull/52081
closes odoo/odoo#52114
X-original-commit: 7760898de4e14fa30db1db87dfa05276bfcaa2bb
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src/js')
| -rw-r--r-- | addons/website/static/src/js/editor/snippets.editor.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index e5b1d525316..dd4f974918b 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -52,17 +52,17 @@ weSnippetEditor.Class.include({ this.el.appendChild(this.fakeThemeEl); } - await this._activateSnippet($(this.fakeThemeEl)); - - if (!this.themeCustomizationMenuEl) { - this.themeCustomizationMenuEl = document.createElement('div'); - for (const node of this.customizePanel.childNodes) { - this.themeCustomizationMenuEl.appendChild(node); - } - } + // Need all of this in that order so that: + // - the element is visible and can be enabled and the onFocus method is + // called each time. + // - the element is hidden afterwards so it does not take space in the + // DOM, same as the overlay which may make a scrollbar appear. + this.fakeThemeEl.classList.remove('d-none'); + const editor = await this._activateSnippet($(this.fakeThemeEl)); + this.fakeThemeEl.classList.add('d-none'); + editor.toggleOverlay(false); this._updateLeftPanelContent({ - content: this.themeCustomizationMenuEl, tab: this.tabs.THEME, }); }, |
