Hide settings when clicked on another block
[MAILPOET-1974]
This commit is contained in:
@@ -71,6 +71,9 @@ BL.TextEditorBehavior = Marionette.Behavior.extend({
|
||||
});
|
||||
|
||||
editor.on('click', function onClick(e) {
|
||||
if (App.getShowedSettingsId()) {
|
||||
App.getChannel().trigger('hideSettings');
|
||||
}
|
||||
// if caret not in editor, place it there (triggers focus on editor)
|
||||
if (document.activeElement !== editor.targetElm) {
|
||||
editor.selection.placeCaretAt(e.clientX, e.clientY);
|
||||
|
@@ -226,6 +226,14 @@ Module.BlockToolsView = AugmentedView.extend({
|
||||
},
|
||||
changeSettings: function changeSettings(options) {
|
||||
var ViewType = this.getSettingsView();
|
||||
var showedSettingsId = App.getShowedSettingsId();
|
||||
if (showedSettingsId) {
|
||||
if (showedSettingsId === this.model.cid) {
|
||||
return;
|
||||
}
|
||||
App.getChannel().trigger('hideSettings');
|
||||
return;
|
||||
}
|
||||
App.getChannel().trigger('settingsShowed', this.model.cid);
|
||||
(new ViewType(_.extend({ model: this.model }, options || {}))).render();
|
||||
},
|
||||
|
Reference in New Issue
Block a user