PE-151, need to use setWindowOpenHandler (in new version of electron) instead of new-window event.

This commit is contained in:
sawka 2023-09-16 13:08:30 -07:00
parent caa11748e5
commit 8b8f7cda7b

View File

@ -281,8 +281,7 @@ function createMainWindow(clientData) {
win.on("close", () => {
MainWindow = null;
});
win.webContents.on("new-window", (e, url) => {
e.preventDefault();
win.webContents.setWindowOpenHandler(({url, frameName}) => {
if (url.startsWith("https://docs.getprompt.dev/")) {
electron.shell.openExternal(url);
} else if (url.startsWith("https://discord.gg/")) {
@ -293,6 +292,7 @@ function createMainWindow(clientData) {
let newUrl = decodeURIComponent(param);
electron.shell.openExternal(newUrl);
}
return { action: 'deny' };
});
return win;
}