Skip to content

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

fix: isNoteEmpty causing crashes

thecodrr47d01235eda9
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index 0277decc5..c24047906 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -225,7 +225,9 @@ function isNoteEmpty(note) {
locked,
} = note;
const isTitleEmpty = !title || !title.trim().length;
- const isTextEmpty = !isHex(text) && (!text || !text.trim().length);
+ let textLength =
+ text.data != null ? text.data.trim().length : text.trim().length;
+ const isTextEmpty = !isHex(text) && (!text || !textLength);
const isDeltaEmpty = !isHex(delta) && (!delta || !delta.ops);
return !locked && isTitleEmpty && isTextEmpty && isDeltaEmpty;
}