[FIX] web_editor: remove old values in the color picker widget previews
This [first commit] removes the addition and removal of classes on the color picker preview. So far so good, then this [other commit] puts back the class addition but forgets the removal so the preview of the color picker widget kept the old values when they were `bg-*` which could lead to a bad preview of the selected color. This commit fixes that by removing the old values when a new value is set. Steps to reproduce the bug fixed by this commit: - Go to the website app - Edit a page - Drop a Picture block - Change the background color of the block to bg-black for example - Change again the background color of the block to a custom color => The preview of the custom color is not correct, it is still black. [first commit]: https://github.com/odoo/odoo/commit/212a8bfdd21269b18054200b9e2585e1c95540d6 [other commit]: https://github.com/odoo/odoo/commit/a396f791da94d064d58cce15892e74f45d29b7b7 task-2904507 closes odoo/odoo#101828 X-original-commit: 6da33797798e6112e0dd74a4093f296b6e1b2466 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -1476,6 +1476,8 @@ const ColorpickerUserValueWidget = SelectUserValueWidget.extend({
|
||||
|
||||
await this._colorPaletteRenderPromise;
|
||||
|
||||
const classes = weUtils.computeColorClasses(this.colorPalette.getColorNames());
|
||||
this.colorPreviewEl.classList.remove(...classes);
|
||||
this.colorPreviewEl.style.removeProperty('background-color');
|
||||
this.colorPreviewEl.style.removeProperty('background-image');
|
||||
const prefix = this.options.dataAttributes.colorPrefix || 'bg';
|
||||
|
||||
Reference in New Issue
Block a user