From 8eb8a982f9627c8d2cccf5d6b8241eec011e03e2 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 26 Aug 2015 10:10:01 +0200 Subject: [PATCH] [FIX] web_editor: clean_for_save all dirty options Clean for save was only called on o_dirty nodes but o_dirty is added only on o_editable nodes. Could use a simple jQuery selector '.o_dirty, .o_dirty *' but need to improve speed for user experience. --- addons/web_editor/static/src/js/snippets.editor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js index 3de9b71d5f8..5bc2f2aa4ad 100644 --- a/addons/web_editor/static/src/js/snippets.editor.js +++ b/addons/web_editor/static/src/js/snippets.editor.js @@ -507,7 +507,13 @@ var BuildingBlock = Widget.extend({ for (var k in template) { var Option = opt[template[k]['option']]; if (Option && Option.prototype.clean_for_save !== dummy) { - template[k].selector.all().filter(".o_dirty").each(function () { + template[k].selector.all().filter(function () { + var node = this; + while (!/o_dirty|o_editable/.test(node.className) && node !== document) { + node = node.parentNode; + } + return node.className.indexOf("o_dirty") !== -1; + }).each(function () { new Option(self, null, $(this), k).clean_for_save(); }); }