From 229fab5fa080a1602cd93a2d8cf3e4bd20587aed Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 26 Oct 2016 17:01:26 +0200 Subject: [PATCH] [FIX] web_editor: do not delete empty .oe_structure element If a snippet contains a .oe_structure element inside of it, it allows the user to drop other snippets in that location. The web_editor contains code which removes all empty parent of an element being deleted. This is done so that, for example, when the last col of a 3-col snippet is removed, the whole snippet is removed. However, there was an exception to this rule which was not considered, if one of these empty parent is an .oe_structure, it should not be removed. Note: the only snippet which does this is the parallax snippet. --- addons/web_editor/static/src/js/snippets.editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js index 6cf2a9d33fd..19251f75af2 100644 --- a/addons/web_editor/static/src/js/snippets.editor.js +++ b/addons/web_editor/static/src/js/snippets.editor.js @@ -1076,12 +1076,12 @@ data.Editor = Class.extend({ if($parent.closest(":data(\"snippet-editor\")").length) { while (!$parent.data("snippet-editor")) { var $nextParent = $parent.parent(); - if ($parent.children().length === 0 && $parent.text().trim() === "") { + if ($parent.children().length === 0 && $parent.text().trim() === "" && !$parent.hasClass("oe_structure")) { $parent.remove(); } $parent = $nextParent; } - if ($parent.children().length === 0 && $parent.text().trim() === "") { + if ($parent.children().length === 0 && $parent.text().trim() === "" && !$parent.hasClass("oe_structure")) { _.defer(function () { $parent.data("snippet-editor").on_remove(); });