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:
Yuya Ochiai
2016-01-12 21:28:08 +09:00
parent e53a43d17a
commit f2209aa9dd

View File

@@ -17,6 +17,8 @@ const path = require('path');
const settings = require('../common/settings');
remote.getCurrentWindow().removeAllListeners('focus');
var MainPage = React.createClass({
getInitialState: function() {
return {
@@ -24,6 +26,13 @@ var MainPage = React.createClass({
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) {
this.setState({
key: key