[FIX] web_editor: reactivate automaticStep on resize
[Commit 1] made sure the history worked when resizing elements by calling `odooEditor.automaticStepUnactive()`, but applied its counterpart `automaticStepActive()` only at the very end of the action, leaving some `return` statements on the way that could break the flow. This commit calls `automaticStepActive` just before leaving the listener and moves `automaticStepUnactive` just before the first DOM modification. It's both more logical and avoids returns pitfalls. Note: `automaticStepActive()` makes sure modifications made on the DOM through the browser's developer tools are tracked and can be reversed with the undo button. Not reactivating it in time means some flows could be broken (until another method reactivates it). [Commit 1]: https://github.com/odoo/odoo/commit/423f4bd2a6cc47e69699d2437eaa5acda94bb98d Related to task-3576046 closes odoo/odoo#146249 X-original-commit: b99cc41e4352d3ff9bffe7b0a5436edbef0ab01b Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Robin Lejeune (role) <role@odoo.com>
This commit is contained in:
@@ -4526,7 +4526,6 @@ registry.sizing = SnippetOptionWidget.extend({
|
||||
let resizeValues = this._getSize();
|
||||
this.$handles.on('mousedown', function (ev) {
|
||||
ev.preventDefault();
|
||||
self.options.wysiwyg.odooEditor.automaticStepUnactive('resizing');
|
||||
isMobile = weUtils.isMobileView(self.$target[0]);
|
||||
|
||||
// First update size values as some element sizes may not have been
|
||||
@@ -4621,6 +4620,8 @@ registry.sizing = SnippetOptionWidget.extend({
|
||||
directions.push(props);
|
||||
}
|
||||
|
||||
self.options.wysiwyg.odooEditor.automaticStepUnactive('resizing');
|
||||
|
||||
const cursor = $handle.css('cursor') + '-important';
|
||||
const $body = $(this.ownerDocument.body);
|
||||
$body.addClass(cursor);
|
||||
@@ -4690,6 +4691,8 @@ registry.sizing = SnippetOptionWidget.extend({
|
||||
self.$target[0].classList.add(gColClass.substring(2));
|
||||
}
|
||||
|
||||
self.options.wysiwyg.odooEditor.automaticStepActive('resizing');
|
||||
|
||||
if (directions.every(dir => dir.begin === dir.current)) {
|
||||
return;
|
||||
}
|
||||
@@ -4697,8 +4700,6 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user