Skip to content

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

core: add fn to remove all notebooks from a note

Abdullah Atta66fe109eb9b5
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index 244cf1421..c7de345f2 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -363,6 +363,21 @@ export default class Notes extends Collection {
if (rebuildCache) this.topicReferences.rebuild();
}
+ async removeFromAllNotebooks(...noteIds) {
+ for (const noteId of noteIds) {
+ const note = this.note(noteId);
+ if (!note || note.deleted || !note.notebooks) {
+ continue;
+ }
+
+ await this._db.notes.add({
+ id: noteId,
+ notebooks: []
+ });
+ }
+ this.topicReferences.rebuild();
+ }
+
async _clearAllNotebookReferences(notebookId) {
const notes = this._db.notes.all;