[FIX] web_editor: fix the resizing history

This commit fixes the issue where the undo of the resizing of an
element is not done in one step.

Steps to reproduce:
- drop a snippet (like text-image)
- resize the image
- undo
=> you have to click multiple times before going back to the initial
size.

task-2968749

closes odoo/odoo#101693

X-original-commit: c4b8a2a6a7548e8a81d1ded58e6bc0e309b02975
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Soukéina Bojabza
2022-09-30 13:35:59 +02:00
committed by qsm-odoo
parent be207ca132
commit d6ce5157ab
@@ -4200,6 +4200,7 @@ registry.sizing = SnippetOptionWidget.extend({
let resizeValues = this._getSize();
this.$handles.on('mousedown', function (ev) {
ev.preventDefault();
self.options.wysiwyg.odooEditor.automaticStepUnactive('resizing');
// If the handle has the class 'readonly', don't allow to resize.
// (For the grid handles when we are in mobile view).
@@ -4379,6 +4380,8 @@ registry.sizing = SnippetOptionWidget.extend({
setTimeout(function () {
self.options.wysiwyg.odooEditor.historyStep();
}, 0);
self.options.wysiwyg.odooEditor.automaticStepActive('resizing');
};
$body.on('mousemove', bodyMouseMove);
$body.on('mouseup', bodyMouseUp);