From 4a05740bd36c4da2661abc3dd0e9651a71cc6a30 Mon Sep 17 00:00:00 2001 From: "Mahdi Cheikh Rouhou (macr)" Date: Tue, 5 Mar 2024 12:19:37 +0100 Subject: [PATCH] [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) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index ef28be79a70..6b80d9b06e4 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -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.