From 51701be864b82d8317ddbb1df2f17c5e93d7b235 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Wed, 13 Mar 2024 14:14:39 +0100 Subject: [PATCH] [FIX] website: not create editors for form field parts Since [1] when the "Padding (Y, X)" option was added, form elements are recognized as columns because they match the `.row > div` selector of that new option. This commit excludes those form elements from this option's selector. Steps to reproduce: - Drop a website form. - Click on field's input. => An empty "Column" editor appeared in the side panel, and an error occurred when trying to delete it. [1]: https://github.com/odoo/odoo/commit/11418cc6f0afcc8e14869f4f38ae0d6d462ac712 task-3748574 closes odoo/odoo#157572 Signed-off-by: Benjamin Vray (bvr) --- addons/website/static/src/js/editor/snippets.editor.js | 7 +++++++ addons/website/views/snippets/snippets.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index d1d60f0cdfc..d3d8ced4059 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -187,6 +187,13 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({ // "Effect" option of the "On Hover" animation option. const hoverEffectSelectEl = $html.find('[data-set-img-shape-hover-effect]')[0]; delete hoverEffectSelectEl.dataset.noPreview; + + // TODO remove in master: as a stable fix we exclude the form fields + // from the grid cell's Padding (Y, X) option. + const gridColumnsEl = $html.find('[data-js="GridColumns"]')[0]; + if (gridColumnsEl) { + gridColumnsEl.dataset.selector = ".row:not(.s_col_no_resize) > div"; + } }, /** * Depending of the demand, reconfigure they gmap key or configure it diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index d90dadfa2c4..5f2093cb34d 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -681,7 +681,7 @@
+ data-selector=".row:not(.s_col_no_resize) > div">