diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index ea5801786cf..0e0ea70d3c2 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -154,6 +154,28 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({ FontFamilyPickerUserValueWidget.prototype.fontVariables = fontVariables; return this._super(...arguments); }, + /** + * @override + */ + _patchForComputeSnippetTemplates($html) { + this._super(...arguments); + + // TODO adapt in master: as a stable fix we corrected the behavior of + // the logo button that led to an error when switching from Text to + // Logo. Remove me in master. + const logoViewName = 'website.option_header_brand_logo'; + const logoButtonEl = $html.find(`[data-customize-website-views="${logoViewName}"]`)[0]; + if (logoButtonEl) { + logoButtonEl.dataset.customizeWebsiteViews = `|website.option_header_brand_name|${logoViewName}`; + logoButtonEl.dataset.resetViewArch = "true"; + } + const brandSelectorEl = $html.find('[data-name="option_header_brand_none"]')[0] + ?.closest("[data-selector]"); + if (brandSelectorEl) { + brandSelectorEl.dataset.selector = brandSelectorEl.dataset.selector + .replace('.navbar-brand.logo', '.navbar-brand'); + } + }, /** * Depending of the demand, reconfigure they gmap key or configure it * if not already defined. diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index 08374a81f1f..3426d31131e 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -1018,6 +1018,7 @@ data-customize-website-views="website.header_call_to_action" data-reset-view-arch="true" data-reload="/"/> + +