Compare commits

...

1 Commits

Author SHA1 Message Date
Abdullah Atta
10d7e46342 core: add support for archiving notes 2023-06-03 23:06:21 +05:00
2 changed files with 10 additions and 2 deletions

View File

@@ -133,6 +133,7 @@ export default class Notes extends Collection {
localOnly: !!note.localOnly, localOnly: !!note.localOnly,
conflicted: !!note.conflicted, conflicted: !!note.conflicted,
readonly: !!note.readonly, readonly: !!note.readonly,
archived: !!note.archived,
dateCreated: note.dateCreated, dateCreated: note.dateCreated,
dateEdited: note.dateEdited || note.dateCreated || Date.now(), dateEdited: note.dateEdited || note.dateCreated || Date.now(),
@@ -165,8 +166,11 @@ export default class Notes extends Collection {
* @returns {any[]} * @returns {any[]}
*/ */
get all() { get all() {
const items = this._collection.getItems(); return this._collection.getItems();
return items; }
get archived() {
return this.all.filter((item) => item.archived === true);
} }
get pinned() { get pinned() {

View File

@@ -217,6 +217,10 @@ export default class Note {
return this._toggle("pinned"); return this._toggle("pinned");
} }
archive() {
return this._toggle("archived");
}
readonly() { readonly() {
return this._toggle("readonly"); return this._toggle("readonly");
} }