[FIX] web_editor: handle palette history better
Before this commit several history steps were added when picking a color and history steps were added when previewing a color. After this commit history is only updated on color selection and not during color preview: applying the color relies on execCommand which adds an history step => no need to add another step upon picking a color but must be prevented during preview. task-2599771 closes odoo/odoo#76417 X-original-commit: 4c1956d697a52e4d561e93930bb9e9f5c61e8a35 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
This commit is contained in:
@@ -1108,13 +1108,17 @@ const Wysiwyg = Widget.extend({
|
||||
this.odooEditor.historyResetLatestComputedSelection(true);
|
||||
}
|
||||
this._processAndApplyColor(eventName, ev.data.color);
|
||||
this.odooEditor.historyStep();
|
||||
});
|
||||
colorpicker.on('color_hover color_leave', null, ev => {
|
||||
if (hadNonCollapsedSelection) {
|
||||
this.odooEditor.historyResetLatestComputedSelection(true);
|
||||
}
|
||||
this._processAndApplyColor(eventName, ev.data.color);
|
||||
this.odooEditor.historyPauseSteps();
|
||||
try {
|
||||
this._processAndApplyColor(eventName, ev.data.color);
|
||||
} finally {
|
||||
this.odooEditor.historyUnpauseSteps();
|
||||
}
|
||||
});
|
||||
colorpicker.on('enter_key_color_colorpicker', null, () => {
|
||||
$dropdown.children('.dropdown-toggle').dropdown('hide');
|
||||
|
||||
Reference in New Issue
Block a user