From 33b86b26e35387bda131f8a1d2822cc09a06e62b Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Tue, 25 Apr 2023 15:10:22 +0000 Subject: [PATCH] [FIX] web_editor: fix resizing and padding options of snippets Since this commit [1], the resizing and padding options of snippets are not functioning properly in the website's edit mode. For example, if a user wants to increase the width of a column to the right, nothing happens. The user must first reduce the column by moving to the left with the mouse before being able to increase it to the right. The same problem occurs when attempting to adjust the padding using the handle buttons. This issue was caused by a numeric value ('key') being changed to a string. [1]: https://github.com/odoo/odoo/commit/800223ae7c5891bf700d45eb6d5f541093dc273c task-3289164 closes odoo/odoo#119681 Signed-off-by: loco-odoo --- addons/web_editor/static/src/js/editor/snippets.options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7d985db529b..fbc066bc72c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4445,13 +4445,13 @@ registry.sizing = SnippetOptionWidget.extend({ let current = 0; const cssProperty = resize[2]; const cssPropertyValue = parseInt(self.$target.css(cssProperty)); - for (const [key, val] of Object.entries(resize[0])) { + resize[0].forEach((val, key) => { if (self.$target.hasClass(val)) { current = key; } else if (resize[1][key] === cssPropertyValue) { current = key; } - } + }); props.resize = resize; props.current = current;