commit
dcbf18e863
|
@ -63,6 +63,14 @@ var MainPage = React.createClass({
|
||||||
this.handleSelect(this.state.key - 1);
|
this.handleSelect(this.state.key - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// reload the activated tab
|
||||||
|
ipcRenderer.on('reload-tab', (event) => {
|
||||||
|
this.refs[`mattermostView${this.state.key}`].reload();
|
||||||
|
});
|
||||||
|
ipcRenderer.on('clear-cache-and-reload-tab', (event) => {
|
||||||
|
this.refs[`mattermostView${this.state.key}`].clearCacheAndReload();
|
||||||
|
});
|
||||||
|
|
||||||
var focusListener = function() {
|
var focusListener = function() {
|
||||||
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||||
webview.focus();
|
webview.focus();
|
||||||
|
@ -185,7 +193,7 @@ var MainPage = React.createClass({
|
||||||
}
|
}
|
||||||
var id = 'mattermostView' + index;
|
var id = 'mattermostView' + index;
|
||||||
return (<MattermostView key={ id } id={ id } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange }
|
return (<MattermostView key={ id } id={ id } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange }
|
||||||
onNotificationClick={ handleNotificationClick } />)
|
onNotificationClick={ handleNotificationClick } ref={ id } />)
|
||||||
});
|
});
|
||||||
var views_row = (<Row>
|
var views_row = (<Row>
|
||||||
{ views }
|
{ views }
|
||||||
|
@ -401,6 +409,16 @@ var MattermostView = React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
reload: function() {
|
||||||
|
var webview = ReactDOM.findDOMNode(this.refs.webview);
|
||||||
|
webview.reload();
|
||||||
|
},
|
||||||
|
clearCacheAndReload() {
|
||||||
|
var webContents = ReactDOM.findDOMNode(this.refs.webview).getWebContents();
|
||||||
|
webContents.session.clearCache(() => {
|
||||||
|
webContents.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
const errorView = this.state.errorInfo ? (<ErrorView id={ this.props.id + '-fail' } style={ this.props.style } className="errorView" errorInfo={ this.state.errorInfo }></ErrorView>) : null;
|
const errorView = this.state.errorInfo ? (<ErrorView id={ this.props.id + '-fail' } style={ this.props.style } className="errorView" errorInfo={ this.state.errorInfo }></ErrorView>) : null;
|
||||||
// 'disablewebsecurity' is necessary to display external images.
|
// 'disablewebsecurity' is necessary to display external images.
|
||||||
|
|
|
@ -99,18 +99,27 @@ var createTemplate = function(mainWindow, config) {
|
||||||
accelerator: 'CmdOrCtrl+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
focusedWindow.reload();
|
if (focusedWindow === mainWindow) {
|
||||||
|
mainWindow.webContents.send('reload-tab');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
focusedWindow.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Clear Cache and Reload',
|
label: 'Clear Cache and Reload',
|
||||||
accelerator: 'Shift+CmdOrCtrl+R',
|
accelerator: 'Shift+CmdOrCtrl+R',
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
// TODO: should reload the selected tab only
|
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
focusedWindow.webContents.session.clearCache(function() {
|
if (focusedWindow === mainWindow) {
|
||||||
focusedWindow.reload();
|
mainWindow.webContents.send('clear-cache-and-reload-tab');
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
focusedWindow.webContents.session.clearCache(function() {
|
||||||
|
focusedWindow.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Reference in a new issue