[FIX] web_editor: apply color unremovable

Steps to reproduce the issue:
=============================
- Go to website and open editor
- Click on the 'Contact Us' button
- Change the color of the text
- error

Origin of the issue:
====================
`HistoryReverCurrentStep` will call `observerFlush` which will mark
`_toRollback = true` and in `_observeOdooFieldChanges` we will update
the html with `withoutRollback` but this only works only if
`_toRollback` is `false`.

Solution:
=========
We need to rever  the step without rollback too.

task-3770287

closes odoo/odoo#156461

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Mahdi Cheikh Rouhou (macr)
2024-04-03 14:29:07 +00:00
parent 1154556a0e
commit 4a05740bd3
@@ -190,7 +190,8 @@ export class Wysiwyg extends Component {
selectedTab: 'theme-colors',
withGradients: true,
onColorLeave: () => {
this.odooEditor.historyRevertCurrentStep();
// We need to prevent rollback in case the seclection is in unremovable
this.odooEditor.withoutRollback(() => this.odooEditor.historyRevertCurrentStep());
// Compute the selection to ensure it's preserved between
// selectionchange events in case this gets triggered multiple
// times quickly.