mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(edit-docs): main window not starting properly
This commit is contained in:
parent
9688013c91
commit
b0fe4f67d8
@ -44,7 +44,7 @@ async function main() {
|
|||||||
await import("@triliumnext/server/src/main.js");
|
await import("@triliumnext/server/src/main.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function onReady() {
|
async function onReady() {
|
||||||
// electron.app.setAppUserModelId('com.github.zadam.trilium');
|
// electron.app.setAppUserModelId('com.github.zadam.trilium');
|
||||||
|
|
||||||
// if db is not initialized -> setup process
|
// if db is not initialized -> setup process
|
||||||
|
@ -13,9 +13,9 @@ 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";
|
|
||||||
import type NoteMeta from "@triliumnext/server/src/services/meta/note_meta.js";
|
import type NoteMeta from "@triliumnext/server/src/services/meta/note_meta.js";
|
||||||
|
import electron from "electron";
|
||||||
|
import windowService from "@triliumnext/server/src/services/window.js";
|
||||||
|
|
||||||
interface NoteMapping {
|
interface NoteMapping {
|
||||||
rootNoteId: string;
|
rootNoteId: string;
|
||||||
@ -56,12 +56,25 @@ const NOTE_MAPPINGS: NoteMapping[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
electron.app.on("ready", onReady);
|
const initializedPromise = deferred<void>();
|
||||||
|
electron.app.on("ready", async () => {
|
||||||
|
await initializedPromise;
|
||||||
|
|
||||||
|
console.log("Electron is ready!");
|
||||||
|
|
||||||
|
// Start the server.
|
||||||
|
await import("@triliumnext/server/src/main.js");
|
||||||
|
|
||||||
|
// Create the main window.
|
||||||
|
await windowService.createMainWindow(electron.app);
|
||||||
|
|
||||||
|
// Wait for the import to be finished and the application to be loaded before we listen to changes.
|
||||||
|
setTimeout(() => registerHandlers(), 10_000);
|
||||||
|
});
|
||||||
|
|
||||||
await initializeTranslations();
|
await initializeTranslations();
|
||||||
await initializeDatabase(true);
|
await initializeDatabase(true);
|
||||||
|
|
||||||
const initializedPromise = deferred<void>();
|
|
||||||
cls.init(async () => {
|
cls.init(async () => {
|
||||||
for (const mapping of NOTE_MAPPINGS) {
|
for (const mapping of NOTE_MAPPINGS) {
|
||||||
if (!mapping.exportOnly) {
|
if (!mapping.exportOnly) {
|
||||||
@ -71,11 +84,6 @@ async function main() {
|
|||||||
setOptions();
|
setOptions();
|
||||||
initializedPromise.resolve();
|
initializedPromise.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
await initializedPromise;
|
|
||||||
|
|
||||||
// Wait for the import to be finished and the application to be loaded before we listen to changes.
|
|
||||||
setTimeout(() => registerHandlers(), 10_000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setOptions() {
|
async function setOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user