From fbdc541f9c4f4584235ec04d44d438b0675ffe97 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 20 Nov 2019 16:55:27 +0000 Subject: [PATCH] [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) --- .../static/src/js/wysiwyg/widgets/color_palette.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js index ed37d65f096..f73c88a3a25 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js @@ -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); + } } }); }