diff --git a/apps/web/package-lock.json b/apps/web/package-lock.json
index 433721c85..2c0a37851 100644
--- a/apps/web/package-lock.json
+++ b/apps/web/package-lock.json
@@ -21,7 +21,7 @@
"@lingui/react": "5.1.2",
"@mdi/js": "7.4.47",
"@mdi/react": "1.6.1",
- "@notesnook-importer/core": "^2.2.0",
+ "@notesnook-importer/core": "^2.2.1",
"@notesnook/common": "file:../../packages/common",
"@notesnook/core": "file:../../packages/core",
"@notesnook/crypto": "file:../../packages/crypto",
@@ -2949,9 +2949,9 @@
}
},
"node_modules/@notesnook-importer/core": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@notesnook-importer/core/-/core-2.2.0.tgz",
- "integrity": "sha512-gh9wG8KT3vXAp+VTkUpz2n2j8UGj5AqmTX/Gnol0Ct5/hyDXdwVyeXzTFYySdsp8iQbrfXb7I4Y2iGzT5hHdjw==",
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/@notesnook-importer/core/-/core-2.2.1.tgz",
+ "integrity": "sha512-a9L4Z8POhoXp8spfD/tRJVIqO9nVmapq5LEPsBE2QFkIf0Ziu1SbqzGwOJeiEWUxpdBCPCgp32v5djvI2lh4sg==",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
diff --git a/apps/web/package.json b/apps/web/package.json
index 020f2ac61..ddd4970ec 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -19,7 +19,7 @@
"@lingui/react": "5.1.2",
"@mdi/js": "7.4.47",
"@mdi/react": "1.6.1",
- "@notesnook-importer/core": "^2.2.0",
+ "@notesnook-importer/core": "^2.2.1",
"@notesnook/common": "file:../../packages/common",
"@notesnook/core": "file:../../packages/core",
"@notesnook/crypto": "file:../../packages/crypto",
diff --git a/apps/web/src/utils/importer.ts b/apps/web/src/utils/importer.ts
index 4a962e19a..1b01c482f 100644
--- a/apps/web/src/utils/importer.ts
+++ b/apps/web/src/utils/importer.ts
@@ -19,7 +19,6 @@ along with this program. If not, see .
import {
ContentType,
- LegacyNotebook,
Note,
Notebook
} from "@notesnook-importer/core/dist/src/models";
@@ -92,8 +91,7 @@ async function processNote(
hash: attachment.hash,
hashType: attachment.hashType,
filename: attachment.filename,
- // todo: figure out typescript error
- type: attachment.mime
+ mimeType: attachment.mime
});
}
@@ -159,34 +157,13 @@ async function processNote(
}
for (const nb of notebooks) {
- if ("notebook" in nb) {
- const notebookId = await importLegacyNotebook(nb).catch(() => undefined);
- if (!notebookId) continue;
+ const notebookIds = await importNotebook(nb).catch(() => undefined);
+ if (!notebookIds) continue;
+ for (const notebookId of notebookIds)
await db.notes.addToNotebook(notebookId, noteId);
- } else {
- const notebookIds = await importNotebook(nb).catch(() => undefined);
- if (!notebookIds) continue;
- for (const notebookId of notebookIds)
- await db.notes.addToNotebook(notebookId, noteId);
- }
}
}
-/**
- * @deprecated
- */
-async function importLegacyNotebook(
- notebook: LegacyNotebook | undefined
-): Promise {
- if (!notebook) return;
- const nb = await db.notebooks.find(notebook.notebook);
- return nb
- ? nb.id
- : await db.notebooks.add({
- title: notebook.notebook
- });
-}
-
async function importNotebook(
notebook: Notebook,
parent?: NotebookType