[FIX] web_editor: restore colorpicker opacity initialization

Following the new editor's merge at https://github.com/odoo/odoo/pull/29775,
the colorpicker was not properly initializing the opacity component of
the given color anymore.

closes odoo/odoo#30371
This commit is contained in:
qsm-odoo
2019-01-21 10:58:29 +00:00
parent 88e6630992
commit 89d473b479
@@ -391,13 +391,13 @@ ColorpickerDialog.convertColorToRgba = function (color) {
var rgba = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
if (rgba) {
if (rgba[4] === undefined) {
rgba[4] = 100;
rgba[4] = 1;
}
return {
red: parseInt(rgba[1]),
green: parseInt(rgba[2]),
blue: parseInt(rgba[3]),
opacity: parseInt(rgba[4]),
opacity: Math.round(parseFloat(rgba[4]) * 100),
};
} else {
return ColorpickerDialog.convertHexToRgba(color);