mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(edit-docs): get Electron to actually start
This commit is contained in:
parent
b72e7339c8
commit
385182cd97
@ -31,31 +31,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.app.on("ready", async () => {
|
electron.app.on("ready", 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();
|
|
||||||
});
|
|
||||||
|
|
||||||
electron.app.on("will-quit", () => {
|
electron.app.on("will-quit", () => {
|
||||||
electron.globalShortcut.unregisterAll();
|
electron.globalShortcut.unregisterAll();
|
||||||
@ -68,4 +44,30 @@ async function main() {
|
|||||||
await import("@triliumnext/server/src/main.js");
|
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();
|
main();
|
||||||
|
@ -13,6 +13,8 @@ import TaskContext from "@triliumnext/server/src/services/task_context.js";
|
|||||||
import { deferred } from "@triliumnext/server/src/services/utils.js";
|
import { deferred } from "@triliumnext/server/src/services/utils.js";
|
||||||
import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help.js";
|
import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help.js";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
|
import electron from "electron";
|
||||||
|
import { onReady } from "@triliumnext/desktop/src/electron-main.js";
|
||||||
|
|
||||||
interface NoteMapping {
|
interface NoteMapping {
|
||||||
rootNoteId: string;
|
rootNoteId: string;
|
||||||
@ -53,6 +55,8 @@ const NOTE_MAPPINGS: NoteMapping[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
electron.app.on("ready", onReady);
|
||||||
|
|
||||||
await initializeTranslations();
|
await initializeTranslations();
|
||||||
await initializeDatabase(true);
|
await initializeDatabase(true);
|
||||||
|
|
||||||
@ -68,7 +72,6 @@ async function main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await initializedPromise;
|
await initializedPromise;
|
||||||
await startElectron();
|
|
||||||
|
|
||||||
// Wait for the import to be finished and the application to be loaded before we listen to changes.
|
// Wait for the import to be finished and the application to be loaded before we listen to changes.
|
||||||
setTimeout(() => registerHandlers(), 10_000);
|
setTimeout(() => registerHandlers(), 10_000);
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
"eslint.config.mjs"
|
"eslint.config.mjs"
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../server/tsconfig.app.json"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "../desktop/tsconfig.app.json"
|
"path": "../desktop/tsconfig.app.json"
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
"files": [],
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../server"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "../desktop"
|
"path": "../desktop"
|
||||||
},
|
},
|
||||||
|
@ -35,6 +35,10 @@ module.exports = {
|
|||||||
from: "../desktop/dist/assets",
|
from: "../desktop/dist/assets",
|
||||||
to: join(outputDir, "assets")
|
to: join(outputDir, "assets")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
from: "../desktop/dist/public",
|
||||||
|
to: join(outputDir, "public")
|
||||||
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user