From f9265598239f8b0a5dbd1efdec0a4937b0cbebf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= Date: Thu, 15 Sep 2022 07:47:57 +0000 Subject: [PATCH] [FIX] web_editor: solve the history bug when dropping out of a dropzone When dragging a grid item and dropping it outside (near) a dropzone, and then undoing the operation, the grid item didn't return to its original state: some removed classes and style properties were not added back. This would cause the item to be broken and trying to drag it had unexpected results that could even lead to a traceback. This behavior was caused by the fact that the grid item was not attached to any element when these attributes were modified, so the changes happened "nowhere". This commit fixes that. task-2973198 X-original-commit: 83c07fcce898225f06f1ba84059a031409db0627 Part-of: odoo/odoo#102525 --- addons/web_editor/static/src/js/editor/snippets.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 37d21266941..13ef195afa9 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1235,6 +1235,7 @@ var SnippetEditor = Widget.extend({ // Some drop zones might have been disabled. $el = $el.filter(this.$dropZones); if ($el.length) { + $el.after(this.$target); // If the column is not dropped inside a dropzone. if ($el[0].classList.contains('oe_grid_zone')) { // Case when a column is dropped near a grid. @@ -1269,7 +1270,6 @@ var SnippetEditor = Widget.extend({ } } - $el.after(this.$target); this.dropped = true; } }