From f2209aa9dd8f01c07cab1d487abdd55f82d76a93 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Tue, 12 Jan 2016 21:28:08 +0900 Subject: [PATCH] Keep focus on webview after switching to main window When switching window focus, webview lost its focus. Please refer to #10 --- src/browser/index.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/browser/index.jsx b/src/browser/index.jsx index 6e4bd862..f961cae1 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -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