[FIX] web_editor: read both color and bg-color to find custom ones

This was broken during the recent colorpicker refactoring.

closes odoo/odoo#40925

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2019-11-27 09:36:27 +00:00
parent 25dc18bb09
commit fbdc541f9c
@@ -157,10 +157,12 @@ const ColorPaletteWidget = Widget.extend({
const existingColors = new Set(this.summernoteCustomColorsArray.concat(Array.from(this.el.querySelectorAll('.o_custom_color')).map(el => el.style.backgroundColor)));
if (!this.options.excluded.includes('custom')) {
Array.from(this.options.$editable.find('[style*="color"]')).forEach(el => {
const color = el.style.color || el.style.backgroundColor;
if (color && !existingColors.has(color)) {
this._addCustomColorButton(color);
existingColors.add(color);
for (const colorProp of ['color', 'backgroundColor']) {
const color = el.style[colorProp];
if (color && !existingColors.has(color)) {
this._addCustomColorButton(color);
existingColors.add(color);
}
}
});
}