Lose focus on any active element when clicked into empty space in newsletter

[MAILPOET-1811]
This commit is contained in:
Ján Mikláš
2019-05-20 15:47:58 +02:00
committed by Pavel Dohnal
parent 757335bce7
commit 2e5359b7ee

View File

@@ -79,6 +79,9 @@ Module.ContainerBlockModel = base.BlockModel.extend({
Module.ContainerBlocksView = Marionette.CollectionView.extend({
className: 'mailpoet_container',
events: {
click: 'removeFocusFromAnyActiveElement',
},
childView: function (model) {
return App.getBlockTypeView(model.get('type'));
},
@@ -102,6 +105,15 @@ Module.ContainerBlocksView = Marionette.CollectionView.extend({
onChildviewResizeStop: function onChildviewResizeStart(event) {
this.triggerMethod('resizeStop', event);
},
removeFocusFromAnyActiveElement: function removeFocusFromAnyActiveElement(event) {
if (!event || !event.target) {
return;
}
if (event.target.className.indexOf('mailpoet_container_horizontal') === -1) {
return;
}
document.activeElement.blur();
},
});
Module.ContainerBlockView = base.BlockView.extend({