diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js index ed1293229b8..481ba06e6f3 100644 --- a/addons/website/static/src/js/website.snippets.gallery.js +++ b/addons/website/static/src/js/website.snippets.gallery.js @@ -354,18 +354,12 @@ options.registry.gallery_img = options.Class.extend({ editor.reapply(); },0); }, - remove: function (type) { - if (type !== "click") return; - - var self = this; + on_remove: function () { var $parent = snippet_editor.globalSelector.closest(this.$target.parent()); - this.buildingBlock.make_active(false); - this.$target.remove(); - setTimeout(function () { - self.buildingBlock.make_active($parent); - var gallery = $parent.data('snippet-editor').styles.gallery; - gallery.reapply(); - }, 0); + _.defer((function () { + this.buildingBlock.make_active($parent); + $parent.data('snippet-editor').styles.gallery.reapply(); + }).bind(this)); } }); diff --git a/addons/website/views/snippets.xml b/addons/website/views/snippets.xml index 64e6e8571ae..18000e42e77 100644 --- a/addons/website/views/snippets.xml +++ b/addons/website/views/snippets.xml @@ -840,7 +840,6 @@