mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	client: Disable some context options in settings (closes #346)
This commit is contained in:
		| @@ -43,6 +43,7 @@ export default class TreeContextMenu { | |||||||
|                 || (selNodes.length === 1 && selNodes[0] === this.node); |                 || (selNodes.length === 1 && selNodes[0] === this.node); | ||||||
|  |  | ||||||
|         const notSearch = note.type !== 'search'; |         const notSearch = note.type !== 'search'; | ||||||
|  |         const notOptions = !note.noteId.startsWith("_options"); | ||||||
|         const parentNotSearch = !parentNote || parentNote.type !== 'search'; |         const parentNotSearch = !parentNote || parentNote.type !== 'search'; | ||||||
|         const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch; |         const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch; | ||||||
|  |  | ||||||
| @@ -51,25 +52,25 @@ export default class TreeContextMenu { | |||||||
|             { title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, |             { title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, | ||||||
|             { title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "bx bx-plus", |             { title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "bx bx-plus", | ||||||
|                 items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter") : null, |                 items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter") : null, | ||||||
|                 enabled: insertNoteAfterEnabled && noSelectedNotes }, |                 enabled: insertNoteAfterEnabled && noSelectedNotes && notOptions }, | ||||||
|             { title: 'Insert child note <kbd data-command="createNoteInto"></kbd>', command: "insertChildNote", uiIcon: "bx bx-plus", |             { title: 'Insert child note <kbd data-command="createNoteInto"></kbd>', command: "insertChildNote", uiIcon: "bx bx-plus", | ||||||
|                 items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null, |                 items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null, | ||||||
|                 enabled: notSearch && noSelectedNotes }, |                 enabled: notSearch && noSelectedNotes && notOptions }, | ||||||
|             { title: 'Delete <kbd data-command="deleteNotes"></kbd>', command: "deleteNotes", uiIcon: "bx bx-trash", |             { title: 'Delete <kbd data-command="deleteNotes"></kbd>', command: "deleteNotes", uiIcon: "bx bx-trash", | ||||||
|                 enabled: isNotRoot && !isHoisted && parentNotSearch }, |                 enabled: isNotRoot && !isHoisted && parentNotSearch && notOptions }, | ||||||
|             { title: "----" }, |             { title: "----" }, | ||||||
|             { title: 'Search in subtree <kbd data-command="searchInSubtree"></kbd>', command: "searchInSubtree", uiIcon: "bx bx-search", |             { title: 'Search in subtree <kbd data-command="searchInSubtree"></kbd>', command: "searchInSubtree", uiIcon: "bx bx-search", | ||||||
|                 enabled: notSearch && noSelectedNotes }, |                 enabled: notSearch && noSelectedNotes }, | ||||||
|             isHoisted ? null : { title: 'Hoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, |             isHoisted ? null : { title: 'Hoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, | ||||||
|             !isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-door-open" }, |             !isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-door-open" }, | ||||||
|             { title: 'Edit branch prefix <kbd data-command="editBranchPrefix"></kbd>', command: "editBranchPrefix", uiIcon: "bx bx-empty", |             { title: 'Edit branch prefix <kbd data-command="editBranchPrefix"></kbd>', command: "editBranchPrefix", uiIcon: "bx bx-empty", | ||||||
|                 enabled: isNotRoot && parentNotSearch && noSelectedNotes}, |                 enabled: isNotRoot && parentNotSearch && noSelectedNotes && notOptions }, | ||||||
|             { title: "Advanced", uiIcon: "bx bx-empty", enabled: true, items: [ |             { title: "Advanced", uiIcon: "bx bx-empty", enabled: true, items: [ | ||||||
|                     { title: 'Expand subtree <kbd data-command="expandSubtree"></kbd>', command: "expandSubtree", uiIcon: "bx bx-expand", enabled: noSelectedNotes }, |                     { title: 'Expand subtree <kbd data-command="expandSubtree"></kbd>', command: "expandSubtree", uiIcon: "bx bx-expand", enabled: noSelectedNotes }, | ||||||
|                     { title: 'Collapse subtree <kbd data-command="collapseSubtree"></kbd>', command: "collapseSubtree", uiIcon: "bx bx-collapse", enabled: noSelectedNotes }, |                     { title: 'Collapse subtree <kbd data-command="collapseSubtree"></kbd>', command: "collapseSubtree", uiIcon: "bx bx-collapse", enabled: noSelectedNotes }, | ||||||
|                     { title: 'Sort by ... <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, |                     { title: 'Sort by ... <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, | ||||||
|                     { title: 'Recent changes in subtree', command: "recentChangesInSubtree", uiIcon: "bx bx-history", enabled: noSelectedNotes }, |                     { title: 'Recent changes in subtree', command: "recentChangesInSubtree", uiIcon: "bx bx-history", enabled: noSelectedNotes && notOptions }, | ||||||
|                     { title: 'Convert to attachment', command: "convertNoteToAttachment", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted }, |                     { title: 'Convert to attachment', command: "convertNoteToAttachment", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted && notOptions }, | ||||||
|                     { title: 'Copy note path to clipboard', command: "copyNotePathToClipboard", uiIcon: "bx bx-empty", enabled: true } |                     { title: 'Copy note path to clipboard', command: "copyNotePathToClipboard", uiIcon: "bx bx-empty", enabled: true } | ||||||
|                 ] }, |                 ] }, | ||||||
|             { title: "----" }, |             { title: "----" }, | ||||||
| @@ -89,12 +90,12 @@ export default class TreeContextMenu { | |||||||
|             { title: 'Paste after', command: "pasteNotesAfterFromClipboard", uiIcon: "bx bx-paste", |             { title: 'Paste after', command: "pasteNotesAfterFromClipboard", uiIcon: "bx bx-paste", | ||||||
|                 enabled: !clipboard.isClipboardEmpty() && isNotRoot && !isHoisted && parentNotSearch && noSelectedNotes }, |                 enabled: !clipboard.isClipboardEmpty() && isNotRoot && !isHoisted && parentNotSearch && noSelectedNotes }, | ||||||
|             { title: `Duplicate subtree <kbd data-command="duplicateSubtree">`, command: "duplicateSubtree", uiIcon: "bx bx-empty", |             { title: `Duplicate subtree <kbd data-command="duplicateSubtree">`, command: "duplicateSubtree", uiIcon: "bx bx-empty", | ||||||
|                 enabled: parentNotSearch && isNotRoot && !isHoisted }, |                 enabled: parentNotSearch && isNotRoot && !isHoisted && notOptions }, | ||||||
|             { title: "----" }, |             { title: "----" }, | ||||||
|             { title: "Export", command: "exportNote", uiIcon: "bx bx-empty", |             { title: "Export", command: "exportNote", uiIcon: "bx bx-empty", | ||||||
|                 enabled: notSearch && noSelectedNotes }, |                 enabled: notSearch && noSelectedNotes && notOptions }, | ||||||
|             { title: "Import into note", command: "importIntoNote", uiIcon: "bx bx-empty", |             { title: "Import into note", command: "importIntoNote", uiIcon: "bx bx-empty", | ||||||
|                 enabled: notSearch && noSelectedNotes }, |                 enabled: notSearch && noSelectedNotes && notOptions }, | ||||||
|             { title: "Apply bulk actions", command: "openBulkActionsDialog", uiIcon: "bx bx-list-plus", |             { title: "Apply bulk actions", command: "openBulkActionsDialog", uiIcon: "bx bx-list-plus", | ||||||
|                 enabled: true } |                 enabled: true } | ||||||
|         ].filter(row => row !== null); |         ].filter(row => row !== null); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user