From 2b891adc34d659a7d2284fff43733bdf0fe034ee Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 10 Mar 2025 17:41:13 +0200 Subject: [PATCH] feat(edit-docs): create child note for importing --- electron-docs-main.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/electron-docs-main.ts b/electron-docs-main.ts index 9ed19551c..d389cdae2 100644 --- a/electron-docs-main.ts +++ b/electron-docs-main.ts @@ -6,7 +6,7 @@ import type { NoteMetaFile } from "./src/services/meta/note_meta.js"; import cls from "./src/services/cls.js"; import { initializeTranslations } from "./src/services/i18n.js"; -const NOTE_ID_USER_GUIDE = "pOsGYCXsbNQG"; +const NOTE_ID_USER_GUIDE = "_help_user_guide"; const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide"); async function startElectron() { @@ -16,6 +16,9 @@ async function startElectron() { async function main() { await initializeTranslations(); await initializeDatabase(); + cls.init(() => { + importData(); + }); await startElectron(); // await exportData(); @@ -31,6 +34,22 @@ async function initializeDatabase() { }); } +async function importData() { + const beccaLoader = ((await import("./src/becca/becca_loader.js")).default); + const notes = ((await import("./src/services/notes.js")).default); + beccaLoader.load(); + + const becca = ((await import("./src/becca/becca.js")).default); + + notes.createNewNoteWithTarget("into", "none_root", { + parentNoteId: "root", + noteId: NOTE_ID_USER_GUIDE, + title: "User Guide", + content: "The sub-children of this note are automatically synced.", + type: "text" + }); +} + async function exportData() { const zipFilePath = "output.zip";