summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-09-12 13:29:30 +0200
committerqsm-odoo <qsm@odoo.com>2016-09-12 15:35:16 +0200
commit5e9ebcfb01f3250833a543154d072d6c785c9330 (patch)
tree9ae007eb38f0e0a618920f24cad782097e323b68 /addons/web_editor/static/src
parentd3d360ace6003eeb1fe752d5e6bbdc9b81a42e12 (diff)
[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.
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/snippets.editor.js12
1 files changed, 5 insertions, 7 deletions
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);
+ }
});
},