mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Merge branch 'main' of https://github.com/TriliumNext/Trilium
This commit is contained in:
		| @@ -401,9 +401,14 @@ export default class CalendarView extends ViewMode<{}> { | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         // Refresh on note title change. | ||||||
|  |         if (loadResults.getNoteIds().some(noteId => this.noteIds.includes(noteId))) { | ||||||
|  |             this.calendar?.refetchEvents(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // Refresh dataset on subnote change. |         // Refresh dataset on subnote change. | ||||||
|         if (this.calendar && loadResults.getAttributeRows().some((a) => this.noteIds.includes(a.noteId ?? ""))) { |         if (loadResults.getAttributeRows().some((a) => this.noteIds.includes(a.noteId ?? ""))) { | ||||||
|             this.calendar.refetchEvents(); |             this.calendar?.refetchEvents(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,9 +20,7 @@ export function NoteFormatter(cell: CellComponent, _formatterParams, onRendered) | |||||||
|  |  | ||||||
|         const iconClass = note.getIcon(); |         const iconClass = note.getIcon(); | ||||||
|         const title = note.title; |         const title = note.title; | ||||||
|         const { $noteRef } = buildNoteLink(noteId); |         const { $noteRef } = buildNoteLink(noteId, title, iconClass, note.getColorClass()); | ||||||
|         $noteRef.text(title); |  | ||||||
|         $noteRef.prepend($("<span>").addClass(iconClass)); |  | ||||||
|         return $noteRef[0]; |         return $noteRef[0]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -53,15 +51,12 @@ export function NoteFormatter(cell: CellComponent, _formatterParams, onRendered) | |||||||
|  * Custom formatter for the note title that is quite similar to {@link NoteFormatter}, but where the title and icons are read from separate fields. |  * Custom formatter for the note title that is quite similar to {@link NoteFormatter}, but where the title and icons are read from separate fields. | ||||||
|  */ |  */ | ||||||
| export function NoteTitleFormatter(cell: CellComponent) { | export function NoteTitleFormatter(cell: CellComponent) { | ||||||
|     const { noteId, iconClass } = cell.getRow().getData(); |     const { noteId, iconClass, colorClass } = cell.getRow().getData(); | ||||||
|     if (!noteId) { |     if (!noteId) { | ||||||
|         return ""; |         return ""; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const { $noteRef } = buildNoteLink(noteId); |     const { $noteRef } = buildNoteLink(noteId, cell.getValue(), iconClass, colorClass); | ||||||
|     $noteRef.text(cell.getValue()); |  | ||||||
|     $noteRef.prepend($("<span>").addClass(iconClass)); |  | ||||||
|  |  | ||||||
|     return $noteRef[0].outerHTML; |     return $noteRef[0].outerHTML; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -80,10 +75,15 @@ export function MonospaceFormatter(cell: CellComponent) { | |||||||
|     return `<code>${cell.getValue()}</code>`; |     return `<code>${cell.getValue()}</code>`; | ||||||
| } | } | ||||||
|  |  | ||||||
| function buildNoteLink(noteId: string) { | function buildNoteLink(noteId: string, title: string, iconClass: string, colorClass?: string) { | ||||||
|     const $noteRef = $("<span>"); |     const $noteRef = $("<span>"); | ||||||
|     const href = `#root/${noteId}`; |     const href = `#root/${noteId}`; | ||||||
|     $noteRef.addClass("reference-link"); |     $noteRef.addClass("reference-link"); | ||||||
|     $noteRef.attr("data-href", href); |     $noteRef.attr("data-href", href); | ||||||
|  |     $noteRef.text(title); | ||||||
|  |     $noteRef.prepend($("<span>").addClass(iconClass)); | ||||||
|  |     if (colorClass) { | ||||||
|  |         $noteRef.addClass(colorClass); | ||||||
|  |     } | ||||||
|     return { $noteRef, href }; |     return { $noteRef, href }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ export type TableData = { | |||||||
|     labels: Record<string, boolean | string | null>; |     labels: Record<string, boolean | string | null>; | ||||||
|     relations: Record<string, boolean | string | null>; |     relations: Record<string, boolean | string | null>; | ||||||
|     branchId: string; |     branchId: string; | ||||||
|  |     colorClass: string | undefined; | ||||||
|     _children?: TableData[]; |     _children?: TableData[]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -41,6 +42,7 @@ export async function buildRowDefinitions(parentNote: FNote, infos: AttributeDef | |||||||
|             labels, |             labels, | ||||||
|             relations, |             relations, | ||||||
|             branchId: branch.branchId, |             branchId: branch.branchId, | ||||||
|  |             colorClass: note.getColorClass() | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (note.hasChildren() && (maxDepth < 0 || currentDepth < maxDepth)) { |         if (note.hasChildren() && (maxDepth < 0 || currentDepth < maxDepth)) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user