fix(edit-docs): get Electron to actually start

This commit is contained in:
Elian Doran
2025-05-01 17:22:26 +03:00
parent b72e7339c8
commit 385182cd97
5 changed files with 41 additions and 26 deletions

View File

@@ -31,31 +31,7 @@ async function main() {
}
});
electron.app.on("ready", async () => {
// electron.app.setAppUserModelId('com.github.zadam.trilium');
// if db is not initialized -> setup process
// if db is initialized, then we need to wait until the migration process is finished
if (sqlInit.isDbInitialized()) {
await sqlInit.dbReady;
await windowService.createMainWindow(electron.app);
if (process.platform === "darwin") {
electron.app.on("activate", async () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {
await windowService.createMainWindow(electron.app);
}
});
}
tray.createTray();
} else {
await windowService.createSetupWindow();
}
await windowService.registerGlobalShortcuts();
});
electron.app.on("ready", onReady);
electron.app.on("will-quit", () => {
electron.globalShortcut.unregisterAll();
@@ -68,4 +44,30 @@ async function main() {
await import("@triliumnext/server/src/main.js");
}
export async function onReady() {
// electron.app.setAppUserModelId('com.github.zadam.trilium');
// if db is not initialized -> setup process
// if db is initialized, then we need to wait until the migration process is finished
if (sqlInit.isDbInitialized()) {
await sqlInit.dbReady;
await windowService.createMainWindow(electron.app);
if (process.platform === "darwin") {
electron.app.on("activate", async () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {
await windowService.createMainWindow(electron.app);
}
});
}
tray.createTray();
} else {
await windowService.createSetupWindow();
}
await windowService.registerGlobalShortcuts();
}
main();