[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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user