mirror of https://github.com/keeweb/keeweb.git
fix #343: blur input on window blur
This commit is contained in:
parent
f79cba14f9
commit
bba0734a81
|
@ -82,6 +82,7 @@ var AppView = Backbone.View.extend({
|
|||
|
||||
window.onbeforeunload = this.beforeUnload.bind(this);
|
||||
window.onresize = this.windowResize.bind(this);
|
||||
window.onblur = this.windowBlur.bind(this);
|
||||
|
||||
KeyHandler.onKey(Keys.DOM_VK_ESCAPE, this.escPressed, this);
|
||||
KeyHandler.onKey(Keys.DOM_VK_BACK_SPACE, this.backspacePressed, this);
|
||||
|
@ -333,6 +334,12 @@ var AppView = Backbone.View.extend({
|
|||
Backbone.trigger('page-geometry', { source: 'window' });
|
||||
},
|
||||
|
||||
windowBlur: function(e) {
|
||||
if (e.target === window) {
|
||||
Backbone.trigger('page-blur');
|
||||
}
|
||||
},
|
||||
|
||||
escPressed: function() {
|
||||
if (this.views.open && this.model.files.hasOpenFiles()) {
|
||||
this.showEntries();
|
||||
|
|
|
@ -67,6 +67,7 @@ var ListSearchView = Backbone.View.extend({
|
|||
this.listenTo(this, 'hide', this.viewHidden);
|
||||
this.listenTo(Backbone, 'filter', this.filterChanged);
|
||||
this.listenTo(Backbone, 'set-locale', this.setLocale);
|
||||
this.listenTo(Backbone, 'page-blur', this.pageBlur);
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
|
@ -88,6 +89,10 @@ var ListSearchView = Backbone.View.extend({
|
|||
this.render();
|
||||
},
|
||||
|
||||
pageBlur: function() {
|
||||
this.inputEl.blur();
|
||||
},
|
||||
|
||||
viewShown: function() {
|
||||
this.listenTo(KeyHandler, 'keypress', this.documentKeyPress);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue