fix open links

pull/5370/head
bunsenstraat 11 months ago
parent 1034c657ea
commit 8cdb4961a0
  1. 6
      apps/remixdesktop/src/main.ts

@ -1,4 +1,4 @@
import { app, BrowserWindow, dialog, Menu, MenuItem, utilityProcess } from 'electron'; import { app, BrowserWindow, dialog, Menu, MenuItem, shell, utilityProcess } from 'electron';
import path from 'path'; import path from 'path';
@ -27,6 +27,10 @@ export const createWindow = async (dir?: string): Promise<void> => {
preload: path.join(__dirname, 'preload.js') preload: path.join(__dirname, 'preload.js')
}, },
}); });
mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url); // Open URL in user's browser.
return { action: "deny" }; // Prevent the app from opening the URL.
})
if (dir && dir.endsWith('/')) dir = dir.slice(0, -1) if (dir && dir.endsWith('/')) dir = dir.slice(0, -1)
const params = dir ? `?opendir=${encodeURIComponent(dir)}` : ''; const params = dir ? `?opendir=${encodeURIComponent(dir)}` : '';
// and load the index.html of the app. // and load the index.html of the app.

Loading…
Cancel
Save