diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 60fe9f4072e..288df97ad32 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4909,17 +4909,6 @@ registry.Box = SnippetOptionWidget.extend({ registry.layout_column = SnippetOptionWidget.extend({ - /** - * @override - */ - start: function () { - // Needs to be done manually for now because _computeWidgetVisibility - // doesn't go through this option for buttons inside of a select. - // TODO: improve this. - this.$el.find('we-button[data-name="zero_cols_opt"]') - .toggleClass('d-none', !this.$target.is('.s_allow_columns')); - return this._super(...arguments); - }, //-------------------------------------------------------------------------- // Options @@ -5085,6 +5074,20 @@ registry.layout_column = SnippetOptionWidget.extend({ } return this._super(...arguments); }, + /** + * @override + */ + _computeWidgetVisibility(widgetName, params) { + if (widgetName === 'zero_cols_opt') { + // Note: "s_allow_columns" indicates containers which may have + // bare content (without columns) and are allowed to have columns. + // By extension, we only show the "None" option on elements that + // were marked as such as they were allowed to have bare content in + // the first place. + return this.$target.is('.s_allow_columns'); + } + return this._super(...arguments); + }, /** * Adds new columns which are clones of the last column or removes the * last x columns.