From 508a7f980652172a7ed00da43f6bc3bc586089fe Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 12 Jul 2021 10:26:01 +0000 Subject: [PATCH] [IMP] web_editor: consider common colors as custom when used in the page Before this commit, if the user chose the "red" color suggestion, "red" did not appear as a custom color (but the color suggestion was marked as selected). This made sense in the previous colorpalette widgets but not anymore as the suggestions do not always appear in all colorpickers anymore. Now those colors are always considered custom when used in the page and at worst appear as "common" and "custom" at the same time (the "common" one being the one which can appear as selected in that case). Part of https://github.com/odoo/odoo/pull/67545 task-2476601 closes odoo/odoo#67545 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/wysiwyg/widgets/color_palette.js | 5 +---- 1 file changed, 1 insertion(+), 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 c5dd0fd7c25..dcce62f367a 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,7 +38,6 @@ 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, @@ -254,9 +253,7 @@ const ColorPaletteWidget = Widget.extend({ return; } this.el.querySelectorAll('.o_custom_color').forEach(el => el.remove()); - const existingColors = new Set(this.customColorsArray.concat( - Object.keys(this.colorToColorNames) - )); + const existingColors = new Set(Object.keys(this.colorToColorNames)); this.trigger_up('get_custom_colors', { onSuccess: (colors) => { colors.forEach(color => {