From 9698b19bcff1019a8dc29d32e237112353a980ff Mon Sep 17 00:00:00 2001
From: sanchezcarlosjr <24639141+sanchezcarlosjr@users.noreply.github.com>
Date: Mon, 20 Nov 2023 17:52:04 -0800
Subject: [PATCH] feat: import notebook from json
---
src/app/notebook/assistant/assistant.component.html | 2 +-
src/app/notebook/shell/shell.ts | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/app/notebook/assistant/assistant.component.html b/src/app/notebook/assistant/assistant.component.html
index c1b3e75..9e2b1cb 100644
--- a/src/app/notebook/assistant/assistant.component.html
+++ b/src/app/notebook/assistant/assistant.component.html
@@ -1,2 +1,2 @@
-
+
diff --git a/src/app/notebook/shell/shell.ts b/src/app/notebook/shell/shell.ts
index ba7896c..4e51a7e 100644
--- a/src/app/notebook/shell/shell.ts
+++ b/src/app/notebook/shell/shell.ts
@@ -81,7 +81,9 @@ export class Shell {
);
});
environment.addEventListener('shell.ImportNotebook', async (event: CustomEvent) => {
- await this.databaseManager.importDatabase(JSON.parse(await event.detail.file.text()));
+ const notebook = JSON.parse(await event.detail.file.text());
+ await this.databaseManager.bulkInsertBlocks(notebook.blocks);
+ location.href = `${location.origin}?t=${notebook.blocks[0].topic}`;
});
environment.addEventListener('shell.DownloadFile', (event: CustomEvent) => {
downloadFile(event.detail.payload.blobParts, event.detail.payload.options);