[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 <loco@odoo.com>
This commit is contained in:
Benjamin Vray
2023-04-28 16:04:33 +02:00
parent 302c7baa87
commit 33b86b26e3
@@ -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;