[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) <qsm@odoo.com>
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user