Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Commit

Permalink
app webview: catch new-window message from webview (from openning url…
Browse files Browse the repository at this point in the history
… in new window) and open in the player window instead

cmdline check: check that command line is exactly 2 arguments to avoid opening treating Electron dev mode cmdline as a warc
  • Loading branch information
ikreymer committed Oct 30, 2018
1 parent 42804a9 commit e5af56c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const createWindow = function () {

if (openNextFile) {
openWarc(openNextFile);
} else if (process.argv.length > 1 && !process.argv[1].startsWith('-psn')) {
} else if (process.argv.length == 2 && !process.argv[1].startsWith('-psn')) {
openWarc(process.argv[1]);
}

Expand Down Expand Up @@ -275,6 +275,17 @@ app.on('window-all-closed', () => {
app.quit();
});

// Ensure new-window urls are just opened directly in the webview
app.on('web-contents-created', (e, contents) => {
if (contents.getType() == 'webview') {
// Listen for any new window events on the webview
contents.on('new-window', (e, url) => {
e.preventDefault();
contents.loadURL(url);
})
}
})


app.on('will-finish-launching', function() {
app.on('open-file', function(event, filePath) {
Expand Down

0 comments on commit e5af56c

Please sign in to comment.