Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: remove all mention of delta

thecodrrdc95ad86e08b
diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.js
index 35ad6b41b..b3b1c1183 100644
--- a/packages/core/__tests__/notes.test.js
+++ b/packages/core/__tests__/notes.test.js
@@ -117,16 +117,16 @@ test("updating empty note should delete it", () =>
test("get favorite notes", () =>
noteTest({
+ ...TEST_NOTE,
favorite: true,
- content: { delta: [{ insert: "Hello" }], text: "Hello" },
}).then(({ db }) => {
expect(db.notes.favorites.length).toBeGreaterThan(0);
}));
test("get pinned notes", () =>
noteTest({
+ ...TEST_NOTE,
pinned: true,
- content: { delta: [{ insert: "Hello" }], text: "Hello" },
}).then(({ db }) => {
expect(db.notes.pinned.length).toBeGreaterThan(0);
}));
diff --git a/packages/core/__tests__/vault.test.js b/packages/core/__tests__/vault.test.js
index 21223e3d0..edfd51902 100644
--- a/packages/core/__tests__/vault.test.js
+++ b/packages/core/__tests__/vault.test.js
@@ -101,7 +101,7 @@ test("save an edited locked note", () =>
const note = db.notes.note(id).data;
await db.vault.save({
...note,
- content: { type: "delta", data: [{ insert: "hello world\n" }] },
+ content: { type: "tiny", data: "<p>hello world</p>" },
});
const content = await db.content.raw(note.contentId);
diff --git a/packages/core/api/lookup.js b/packages/core/api/lookup.js
index 526f6e710..a42d2a763 100644
--- a/packages/core/api/lookup.js
+++ b/packages/core/api/lookup.js
@@ -15,14 +15,14 @@ export default class Lookup {
}
async notes(notes, query) {
- const deltas = await this._db.content.multi(
+ const contents = await this._db.content.multi(
notes.map((note) => note.contentId)
);
const results = [];
notes.forEach((note) => {
const title = note.title;
if (!note.locked) {
- let content = deltas.find((delta) => delta.id === note.contentId);
+ let content = contents.find((content) => content.id === note.contentId);
content = getContentFromData(content.type, content.data);
if (fzs(query, title) || content.search(query)) results.push(note);
} else {
diff --git a/packages/core/api/migrations.js b/packages/core/api/migrations.js
index 6a7bf79a1..6b0680a71 100644
--- a/packages/core/api/migrations.js
+++ b/packages/core/api/migrations.js
@@ -12,7 +12,8 @@ class Migrations {
}
async init() {
- this.dbVersion = (await this._db.context.read("v")) || 2;
+ this.dbVersion =
+ (await this._db.context.read("v")) || CURRENT_DATABASE_VERSION;
}
async migrate() {
diff --git a/packages/core/api/sync/__tests__/merger.test.js b/packages/core/api/sync/__tests__/merger.test.js
index 570d28433..4480d18b8 100644
--- a/packages/core/api/sync/__tests__/merger.test.js
+++ b/packages/core/api/sync/__tests__/merger.test.js
@@ -14,7 +14,7 @@ import { CURRENT_DATABASE_VERSION } from "../../../common";
const emptyServerResponse = {
notes: [],
notebooks: [],
- delta: [],
+ content: [],
text: [],
tags: [],
colors: [],
@@ -110,7 +110,13 @@ describe.each(tests)(
item.title = "Google";
const result = await merger.merge(
{
- [collection]: [{ id: item.id, ...(await getEncrypted(item)) }],
+ [collection]: [
+ {
+ id: item.id,
+ v: CURRENT_DATABASE_VERSION,
+ ...(await getEncrypted(item)),
+ },
+ ],
synced: false,
},
0
@@ -122,7 +128,7 @@ describe.each(tests)(
}
);
-test("local delta updated after lastSyncedTimestamp should cause merge conflict", () => {
+test("local content updated after lastSyncedTimestamp should cause merge conflict", () => {
StorageInterface.clear();
return noteTest().then(async ({ db, id }) => {
await login(db);
@@ -138,8 +144,8 @@ test("local delta updated after lastSyncedTimestamp should cause merge conflict"
...(await getEncrypted({
id: contentId,
noteId: id,
- type: "delta",
- data: [{ insert: "my name is" }],
+ type: "tiny",
+ data: "<p>my name is</p>",
dateEdited: 2919,
conflicted: false,
resolved: false,
diff --git a/packages/core/api/sync/__tests__/sync.test.js b/packages/core/api/sync/__tests__/sync.test.js
index d0066a6f4..911e76f2c 100644
--- a/packages/core/api/sync/__tests__/sync.test.js
+++ b/packages/core/api/sync/__tests__/sync.test.js
@@ -60,7 +60,7 @@ test("sync without merge conflicts, cause merge conflicts, resolve them and then
type: TEST_NOTE.content.type,
dateEdited: Date.now(),
conflicted: false,
- data: TEST_NOTE.content.data,
+ data: "<p>hello world what are you doing</p>",
})),
};
diff --git a/packages/core/api/sync/collector.js b/packages/core/api/sync/collector.js
index 72f4b418e..dfc86d9e3 100644
--- a/packages/core/api/sync/collector.js
+++ b/packages/core/api/sync/collector.js
@@ -15,7 +15,7 @@ class Collector {
this._map = async (i) => {
const item = { ...i };
- // in case of resolved delta
+ // in case of resolved content
delete item.resolved;
// turn the migrated flag off so we don't keep syncing this item repeated
delete item.migrated;
diff --git a/packages/core/api/sync/merger.js b/packages/core/api/sync/merger.js
index 11b869c76..6e549f412 100644
--- a/packages/core/api/sync/merger.js
+++ b/packages/core/api/sync/merger.js
@@ -14,7 +14,7 @@ class Merger {
_migrate(item, deserialized) {
const version = item.v || 0;
let type = deserialized.type;
- if (deserialized.data) type = "delta";
+ if (!type && deserialized.data) type = "tiny";
const migrate = migrations[version][type];
if (migrate) return migrate(deserialized);
return deserialized;
diff --git a/packages/core/package.json b/packages/core/package.json
index c5142bfe8..cb625174e 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -28,7 +28,6 @@
"no-internet": "^1.5.2",
"qclone": "^1.0.4",
"quill-delta-to-html": "^0.12.0",
- "quill-delta-to-markdown": "https://github.com/streetwriters/quill-delta-to-markdown",
"spark-md5": "^3.0.1",
"transfun": "^1.0.2",
"turndown": "^7.0.0"
diff --git a/packages/core/yarn.lock b/packages/core/yarn.lock
index 6cd38dc05..9448fd9bb 100644
--- a/packages/core/yarn.lock
+++ b/packages/core/yarn.lock
@@ -4091,10 +4091,6 @@ quill-delta-to-html@^0.12.0:
dependencies:
lodash.isequal "^4.5.0"
-"quill-delta-to-markdown@https://github.com/streetwriters/quill-delta-to-markdown":
- version "0.7.0"
- resolved "https://github.com/streetwriters/quill-delta-to-markdown#8854bc4882f99f5229cfbd22cf0697d14e725755"
-
react-is@^16.12.0, react-is@^16.8.4:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"