From bd8260b3f56cc77014762e7ed12aec8a1ac5a839 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 12 Oct 2021 09:40:06 +0000 Subject: [PATCH] [FIX] web_editor: not showing toolbar in theme tab In the website builder, the toolbar was appearing in the theme tab incorrectly. task-2664956 closes odoo/odoo#79311 X-original-commit: a2198490befddb8c4cc6f3a543f47bbffe243f64 Signed-off-by: David Monjoie (dmo) --- .../web_editor/static/src/js/editor/snippets.editor.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 07c4d9e7b81..18e62245151 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -166,6 +166,7 @@ var SnippetEditor = Widget.extend({ this.$scrollingElement = $(this.ownerDocument).find('.o_editable'); } this.displayOverlayOptions = false; + this._$toolbarContainer = $(); this.__isStarted = new Promise(resolve => { this.__isStartedResolveFunc = resolve; @@ -2522,6 +2523,7 @@ var SnippetsMenu = Widget.extend({ this._currentTab = tab || this.tabs.BLOCKS; + this._$toolbarContainer[0].remove(); if (content) { while (this.customizePanel.firstChild) { this.customizePanel.removeChild(this.customizePanel.firstChild); @@ -3156,12 +3158,12 @@ var SnippetsMenu = Widget.extend({ this.options.wysiwyg.toolbar.el.classList.remove('oe-floating'); // Create toolbar custom container. - const $customizeBlock = $(''); + this._$toolbarContainer = $(''); const $title = $("" + titleText + ""); - $customizeBlock.append($title); - $customizeBlock.append(this.options.wysiwyg.toolbar.$el); - $(this.customizePanel).append($customizeBlock); + this._$toolbarContainer.append($title); + this._$toolbarContainer.append(this.options.wysiwyg.toolbar.$el); + $(this.customizePanel).append(this._$toolbarContainer); // Create table-options custom container. const $customizeTableBlock = $(QWeb.render('web_editor.toolbar.table-options'));