Keep focus on webview after switching to main window
When switching window focus, webview lost its focus. Please refer to #10
This commit is contained in:
@@ -17,6 +17,8 @@ const path = require('path');
|
|||||||
|
|
||||||
const settings = require('../common/settings');
|
const settings = require('../common/settings');
|
||||||
|
|
||||||
|
remote.getCurrentWindow().removeAllListeners('focus');
|
||||||
|
|
||||||
var MainPage = React.createClass({
|
var MainPage = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
@@ -24,6 +26,13 @@ var MainPage = React.createClass({
|
|||||||
unreadCounts: new Array(this.props.teams.length)
|
unreadCounts: new Array(this.props.teams.length)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
componentDidMount: function() {
|
||||||
|
var thisObj = this;
|
||||||
|
remote.getCurrentWindow().on('focus', function() {
|
||||||
|
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||||
|
webview.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
handleSelect: function(key) {
|
handleSelect: function(key) {
|
||||||
this.setState({
|
this.setState({
|
||||||
key: key
|
key: key
|
||||||
|
Reference in New Issue
Block a user