Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liuliu/app: open in new tab #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions main/background.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from "path";
import {
app,
BrowserView,
BrowserWindow,
ipcMain,
Menu,
Expand Down Expand Up @@ -143,3 +144,17 @@ ipcMain.handle("api-config", async () => {
};
return cfg;
});

ipcMain.handle("open-new-tab", async (event, arg) => {
const view=new BrowserWindow({
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
mainWindow.addTabbedWindow(view);

const port = process.argv[2];
const url=isProd?`app://./${arg}`:`http://localhost:${port}${arg}`;
console.log(url);
view.loadURL(url);
})
4 changes: 2 additions & 2 deletions web/hooks/useElectronMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default function useElectronMenu(params: DatabasePageParams) {
break;
}
case "commit-graph": {
const { href, as } = commitGraph(paramsWithRef);
router.push(href, as).catch(console.error);
const { as } = commitGraph(paramsWithRef);
window.ipc.invoke("open-new-tab",as);
break;
}
case "schema-diagram": {
Expand Down
Loading