mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(tree): archive/unarchive notes
This commit is contained in:
		| @@ -13,6 +13,7 @@ import type NoteTreeWidget from "../widgets/note_tree.js"; | |||||||
| import type FAttachment from "../entities/fattachment.js"; | import type FAttachment from "../entities/fattachment.js"; | ||||||
| import type { SelectMenuItemEventListener } from "../components/events.js"; | import type { SelectMenuItemEventListener } from "../components/events.js"; | ||||||
| import utils from "../services/utils.js"; | import utils from "../services/utils.js"; | ||||||
|  | import attributes from "../services/attributes.js"; | ||||||
|  |  | ||||||
| // TODO: Deduplicate once client/server is well split. | // TODO: Deduplicate once client/server is well split. | ||||||
| interface ConvertToAttachmentResponse { | interface ConvertToAttachmentResponse { | ||||||
| @@ -55,6 +56,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree | |||||||
|         const branch = froca.getBranch(this.node.data.branchId); |         const branch = froca.getBranch(this.node.data.branchId); | ||||||
|         const isNotRoot = note?.noteId !== "root"; |         const isNotRoot = note?.noteId !== "root"; | ||||||
|         const isHoisted = note?.noteId === appContext.tabManager.getActiveContext()?.hoistedNoteId; |         const isHoisted = note?.noteId === appContext.tabManager.getActiveContext()?.hoistedNoteId; | ||||||
|  |         const isArchived = note?.isArchived; | ||||||
|         const parentNote = isNotRoot && branch ? await froca.getNote(branch.parentNoteId) : null; |         const parentNote = isNotRoot && branch ? await froca.getNote(branch.parentNoteId) : null; | ||||||
|  |  | ||||||
|         // some actions don't support multi-note, so they are disabled when notes are selected, |         // some actions don't support multi-note, so they are disabled when notes are selected, | ||||||
| @@ -189,6 +191,19 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree | |||||||
|                 enabled: parentNotSearch && isNotRoot && !isHoisted && notOptionsOrHelp |                 enabled: parentNotSearch && isNotRoot && !isHoisted && notOptionsOrHelp | ||||||
|             }, |             }, | ||||||
|  |  | ||||||
|  |             { | ||||||
|  |                 title: !isArchived ? t("tree-context-menu.archive") : t("tree-context-menu.unarchive"), | ||||||
|  |                 uiIcon: !isArchived ? "bx bx-archive" : "bx bx-archive-out", | ||||||
|  |                 handler: () => { | ||||||
|  |                     if (!note) return; | ||||||
|  |                     if (!isArchived) { | ||||||
|  |                         attributes.addLabel(note.noteId, "archived"); | ||||||
|  |                     } else { | ||||||
|  |                         attributes.removeOwnedLabelByName(note, "archived"); | ||||||
|  |                     } | ||||||
|  |                 }, | ||||||
|  |                 enabled: noSelectedNotes | ||||||
|  |             }, | ||||||
|             { |             { | ||||||
|                 title: `${t("tree-context-menu.delete")} <kbd data-command="deleteNotes"></kbd>`, |                 title: `${t("tree-context-menu.delete")} <kbd data-command="deleteNotes"></kbd>`, | ||||||
|                 command: "deleteNotes", |                 command: "deleteNotes", | ||||||
|   | |||||||
| @@ -1594,6 +1594,8 @@ | |||||||
|     "open-in-a-new-split": "Open in a new split", |     "open-in-a-new-split": "Open in a new split", | ||||||
|     "insert-note-after": "Insert note after", |     "insert-note-after": "Insert note after", | ||||||
|     "insert-child-note": "Insert child note", |     "insert-child-note": "Insert child note", | ||||||
|  |     "archive": "Archive", | ||||||
|  |     "unarchive": "Unarchive", | ||||||
|     "delete": "Delete", |     "delete": "Delete", | ||||||
|     "search-in-subtree": "Search in subtree", |     "search-in-subtree": "Search in subtree", | ||||||
|     "hoist-note": "Hoist note", |     "hoist-note": "Hoist note", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user