Fix signup Terms and Policy links not opening in the browser #1280

This commit is contained in:
Ben Gotow 2018-12-28 16:51:24 -07:00
parent b167b9cdcd
commit f242ec69f9
3 changed files with 10 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{
"name": "mailspring",
"productName": "Mailspring",
"version": "1.5.3",
"version": "1.5.4",
"commitHash": "COMMIT_INSERTED_DURING_PACKAGING",
"description": "The best email app for people and teams at work",
"license": "GPL-3.0",

View file

@ -109,6 +109,7 @@ export default class Webview extends React.Component {
'did-finish-load': this._webviewDidFinishLoad,
'did-get-response-details': this._webviewDidGetResponseDetails,
'console-message': this._onConsoleMessage,
'new-window': this._onNewWindow,
};
for (const event of Object.keys(listeners)) {
webview.removeEventListener(event, listeners[event]);
@ -125,6 +126,13 @@ export default class Webview extends React.Component {
webview.reload();
};
_onNewWindow = e => {
const { protocol } = url.parse(e.url);
if (protocol === 'http:' || protocol === 'https:') {
shell.openExternal(e.url);
}
};
_onConsoleMessage = e => {
if (/^http.+/i.test(e.message)) {
shell.openExternal(e.message);

View file

@ -20,7 +20,7 @@
"babel-preset-react": "6.x.x",
"chalk": "1.x.x",
"devtron": "^1.4.0",
"electron": "4.0.0-beta.11",
"electron": "4.0.0",
"electron-installer-dmg": "0.2.x",
"electron-packager": "13.0.x",
"electron-winstaller": "2.x.x",