mirror of https://github.com/keeweb/keeweb.git
fix #1096: focus issues after minimizing
This commit is contained in:
parent
28c9faf48f
commit
e79e903f25
|
@ -1,3 +1,4 @@
|
|||
const Backbone = require('backbone');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Launcher = require('../comp/launcher');
|
||||
|
||||
|
@ -5,10 +6,14 @@ const FocusDetector = {
|
|||
init() {
|
||||
this.isFocused = true;
|
||||
this.detectsFocusWithEvents = !FeatureDetector.isDesktop && !FeatureDetector.isMobile;
|
||||
if (this.detectsFocusWithEvents) {
|
||||
window.onblur = () => { this.isFocused = false; };
|
||||
window.onfocus = () => { this.isFocused = true; };
|
||||
}
|
||||
window.onfocus = () => {
|
||||
this.isFocused = true;
|
||||
Backbone.trigger('focus');
|
||||
};
|
||||
window.onblur = () => {
|
||||
this.isFocused = false;
|
||||
Backbone.trigger('blur');
|
||||
};
|
||||
},
|
||||
|
||||
hasFocus() {
|
||||
|
|
|
@ -69,6 +69,7 @@ const OpenView = Backbone.View.extend({
|
|||
KeyHandler.onKey(Keys.DOM_VK_RETURN, this.enterKeyPress, this);
|
||||
KeyHandler.onKey(Keys.DOM_VK_DOWN, this.moveOpenFileSelectionDown, this);
|
||||
KeyHandler.onKey(Keys.DOM_VK_UP, this.moveOpenFileSelectionUp, this);
|
||||
this.listenTo(Backbone, 'focus', this.windowFocused.bind(this));
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
@ -105,10 +106,12 @@ const OpenView = Backbone.View.extend({
|
|||
return this;
|
||||
},
|
||||
|
||||
windowFocused: function() {
|
||||
this.inputEl.focus();
|
||||
},
|
||||
|
||||
focusInput: function() {
|
||||
console.log('focus');
|
||||
if (FocusDetector.hasFocus()) {
|
||||
console.log('hasFocus');
|
||||
this.inputEl.focus();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
Release notes
|
||||
-------------
|
||||
##### v1.7.5 (2019-02-05)
|
||||
`-` fix #1096: focus issues after minimizing
|
||||
|
||||
##### v1.7.4 (2019-01-17)
|
||||
`-` fix #423: input focus issues in desktop apps
|
||||
|
||||
|
|
Loading…
Reference in New Issue