Open external links (eg. to GitHub or Wiki) in default system browser instead of a new Electron window. (#3159)
This commit is contained in:
parent
fe935e918b
commit
3aa1e8f42b
@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { app } from 'electron';
|
||||
import { app, shell } from 'electron';
|
||||
import { registerAccountStoreHandlers } from '../main/account-store';
|
||||
import { setupAutoUpdater } from './autoUpdater';
|
||||
import { createWindow } from './window';
|
||||
@ -15,4 +15,11 @@ const onReady = async () => {
|
||||
await setupAutoUpdater();
|
||||
};
|
||||
|
||||
app.on('web-contents-created', (e, webContents) => {
|
||||
webContents.on('new-window', (e, url) => {
|
||||
e.preventDefault();
|
||||
shell.openExternal(url).catch(console.error);
|
||||
});
|
||||
});
|
||||
|
||||
app.whenReady().then(onReady).catch(console.error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user