From d2189dc3bfb0f3e1d5f4652254396233ff5c8c61 Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Wed, 30 Jun 2021 14:28:20 +0000 Subject: [PATCH] [FIX] web_editor: correctly display selected basic color When selecting a "basic" color from the color picker, it was displayed as a custom color. It was due to the fact that the basic colors were not correctly computed to build the existing colors: the array of the rows was used instead of the array of the colors. Part of https://github.com/odoo/odoo/pull/72978 task-2476601 closes odoo/odoo#73139 X-original-commit: 23b182ab1bce9a00cb75d12b0d0c504d1fe19e2f Signed-off-by: Quentin Smetz (qsm) --- .../web_editor/static/src/js/wysiwyg/widgets/color_palette.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 955faa039a9..54dc8232bb5 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 @@ -38,6 +38,7 @@ const ColorPaletteWidget = Widget.extend({ */ init: function (parent, options) { this._super.apply(this, arguments); + this.customColorsArray = [].concat(...customColors); this.style = window.getComputedStyle(document.documentElement); this.options = _.extend({ selectedColor: false, @@ -173,7 +174,7 @@ const ColorPaletteWidget = Widget.extend({ return; } this.el.querySelectorAll('.o_custom_color').forEach(el => el.remove()); - const existingColors = new Set(customColors.concat( + const existingColors = new Set(this.customColorsArray.concat( Object.keys(this.colorToColorNames) )); this.trigger_up('get_custom_colors', {