[FIX] web_editor: fixes the rgb/rgba color selection
Before this commit, `selectStyle` could incorrectly split the widgetValue (as described below) which resulted in invalid CSS. widgetValue: `"rgba(55, 12, 99, 0.7) 55px"` result: `["rgba(55,", "12,", "99,", "0.7)", "55px"]` expected: `["rgba(55, 12, 99, 0.7)", "55px"]` fixed: `["rgba(55,12,99,0.7)", "55px"]` This commit fixes the issue. closes odoo/odoo#47515 X-original-commit: 37e6b87341e58769ec2c1d080986e84286d84978 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -1607,7 +1607,9 @@ const SnippetOptionWidget = Widget.extend({
|
||||
widgetValue = `var(--${widgetValue})`;
|
||||
}
|
||||
|
||||
const values = widgetValue.split(/\s+/g);
|
||||
// replacing ', ' by ',' to prevent attributes with internal space separators from being split:
|
||||
// eg: "rgba(55, 12, 47, 1.9) 47px" should be split as ["rgba(55,12,47,1.9)", "47px"]
|
||||
const values = widgetValue.replace(/,\s/g, ',').split(/\s+/g);
|
||||
while (values.length < cssProps.length) {
|
||||
switch (values.length) {
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user