Hide settings when deleting, duplicating or dragging block

[MAILPOET-1974]
This commit is contained in:
Ján Mikláš
2019-05-02 13:36:13 +02:00
committed by M. Shull
parent d735adddd4
commit abbd7873fc

View File

@@ -66,6 +66,7 @@ Module.BlockView = AugmentedView.extend({
onDrop: function onDrop(options) { onDrop: function onDrop(options) {
// After a clone of model has been dropped, cleanup // After a clone of model has been dropped, cleanup
// and destroy self // and destroy self
App.getChannel().trigger('hideSettings');
options.dragBehavior.view.model.destroy(); options.dragBehavior.view.model.destroy();
}, },
onDragSubstituteBy: function onDragSubstituteBy(behavior) { onDragSubstituteBy: function onDragSubstituteBy(behavior) {
@@ -247,11 +248,13 @@ Module.BlockToolsView = AugmentedView.extend({
deleteBlock: function deleteBlock(event) { deleteBlock: function deleteBlock(event) {
event.preventDefault(); event.preventDefault();
this.model.trigger('delete'); this.model.trigger('delete');
App.getChannel().trigger('hideSettings');
return false; return false;
}, },
duplicateBlock: function duplicateBlock(event) { duplicateBlock: function duplicateBlock(event) {
event.preventDefault(); event.preventDefault();
this.model.trigger('duplicate'); this.model.trigger('duplicate');
App.getChannel().trigger('hideSettings');
return false; return false;
}, },
}); });
@@ -280,6 +283,7 @@ Module.BlockSettingsView = Marionette.View.extend({
} else { } else {
MailPoet.Modal.panel(panelParams); MailPoet.Modal.panel(panelParams);
} }
this.listenTo(App.getChannel(), 'hideSettings', this.close);
}, },
templateContext: function templateContext() { templateContext: function templateContext() {
return { return {