summaryrefslogtreecommitdiff
path: root/addons/web_editor
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-10-26 17:01:26 +0200
committerqsm-odoo <qsm@odoo.com>2016-11-03 16:45:27 +0100
commit229fab5fa080a1602cd93a2d8cf3e4bd20587aed (patch)
tree2078e9ab19281bb9bb254e09a64dd87fa098b122 /addons/web_editor
parent76314f0a3bdb4deb05444443826106607fe35c5d (diff)
[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.
Diffstat (limited to 'addons/web_editor')
-rw-r--r--addons/web_editor/static/src/js/snippets.editor.js4
1 files 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();
});