From 5e9ebcfb01f3250833a543154d072d6c785c9330 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 12 Sep 2016 13:29:30 +0200 Subject: [FIX] web_editor: properly call on_remove method of snippet options The snippet options can define an on_remove method which was supposed to be called when the snippet is removed. This was not the case since the method was written so that the options were removed before the on_remove method was called... (Un)fortunately, the on_remove callbacks were not doing any critical job in current implementation. In saas-13 however, some elements will rely on this. --- addons/web_editor/static/src/js/snippets.editor.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'addons/web_editor/static/src/js/snippets.editor.js') diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js index 79db510bf6a..043163802dc 100644 --- a/addons/web_editor/static/src/js/snippets.editor.js +++ b/addons/web_editor/static/src/js/snippets.editor.js @@ -663,7 +663,7 @@ var BuildingBlock = Widget.extend({ animation.start(true, $target); self.call_for_all_snippets($target, function (editor, $snippet) { - editor.drop_and_build_snippet(); + _.defer(function () { editor.drop_and_build_snippet(); }); }); self.create_snippet_editor($target); self.cover_target($target.data('overlay'), $target); @@ -683,12 +683,10 @@ var BuildingBlock = Widget.extend({ var self = this; $snippet.add(globalSelector.all($snippet)).each(function () { var $snippet = $(this); - setTimeout(function () { - self.create_snippet_editor($snippet); - if ($snippet.data("snippet-editor")) { - callback.call(self, $snippet.data("snippet-editor"), $snippet); - } - }); + self.create_snippet_editor($snippet); + if ($snippet.data("snippet-editor")) { + callback.call(self, $snippet.data("snippet-editor"), $snippet); + } }); }, -- cgit v1.2.3