[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) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2021-07-02 11:26:12 +00:00
committed by qsm-odoo
parent e7f497b027
commit d2189dc3bf
@@ -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', {