Skip to content

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

fix: content.delta saved as object instead of hex id

thecodrr6ee472708c7c
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index 3738be2e1..fbcb80830 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -75,7 +75,7 @@ export default class Notes {
if (!textId && isHex(text)) textId = text;
if (!deltaId && isHex(delta)) deltaId = delta;
- if (delta && delta.ops) {
+ if (delta && typeof delta === "object") {
deltaId = await this._deltaCollection.add({
noteId: id,
id: deltaId,
diff --git a/packages/core/utils/index.js b/packages/core/utils/index.js
index bd7400234..91291ae3d 100644
--- a/packages/core/utils/index.js
+++ b/packages/core/utils/index.js
@@ -70,6 +70,7 @@ function groupBySpecial(arr, key) {
var hexPattern = /([A-F]|[a-f]|\d)*/;
export function isHex(input) {
+ if (typeof input !== "string") return false;
if (!input.match || input.length < 16) return false;
return input.match(hexPattern)[0] === input;
}