Skip to content

Commit

Permalink
Merge pull request cerebroapp#69 from KELiON/fix/open-links-in-browser
Browse files Browse the repository at this point in the history
Open links from previews in default browser
  • Loading branch information
KELiON authored Feb 1, 2017
2 parents 58cd0a7 + 2bf39f1 commit 4fc9741
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/main/createWindow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BrowserWindow, globalShortcut, app } from 'electron'
import { BrowserWindow, globalShortcut, app, shell } from 'electron'
import EventEmitter from 'events'
import trackEvent from '../lib/trackEvent'

Expand Down Expand Up @@ -49,6 +49,16 @@ export default ({ src, isDev }) => {
}
})

mainWindow.webContents.on('new-window', (event, url) => {
shell.openExternal(url)
event.preventDefault()
})

mainWindow.webContents.on('will-navigate', (event, url) => {
shell.openExternal(url)
event.preventDefault()
})

// Change global hotkey if it is changed in app settings
mainWindow.settingsChanges.on('hotkey', (value) => {
globalShortcut.unregister(shortcut)
Expand Down

0 comments on commit 4fc9741

Please sign in to comment.