[FIX] web_editor: allow to remove image from gallery thanks to remove button
Commitb309f3ab54made the snippet remove button always be there by removing the "preventParentEmpty" mixin. Instead of preventing to remove the only child of a snippet, the system was changed to remove the parent if this only child is removed. This also applies on the system which hide the remove button if the child cannot be dropped anywhere in the DOM. Unfortunatly the image gallery snippet relied on the remove button to be hidden for its content images. Indeed, it was implemented so that the "remove" button is hidden but a "remove image from gallery" was there in the customize menu. The solution is to remove this option and copy its behavior on the standard remove button. Note: this probably was not done before because the on_remove feature was broken (fixed with commit5e9ebcfb01).
This commit is contained in:
@@ -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));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -840,7 +840,6 @@
|
||||
<li data-position="last"><a href="#">Move to last</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-remove="remove"><a href="#">Remove from gallery</a></li>
|
||||
</div>
|
||||
|
||||
<div data-js='carousel'
|
||||
|
||||
Reference in New Issue
Block a user