From d6ce5157ab9239d795c7a2f293e728a6d4528cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= Date: Wed, 31 Aug 2022 16:31:09 +0000 Subject: [PATCH] [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) --- addons/web_editor/static/src/js/editor/snippets.options.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 548b7fbc14e..a9075890a9d 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -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);