Merge pull request #1240 from rom1dep/calendar_enh_color

feat(view/calendar): support coloring
pull/1242/head
Elian Doran 2025-02-21 17:56:24 +07:00 committed by GitHub
commit 300bb561bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

@ -192,6 +192,7 @@ export default class CalendarView extends ViewMode {
for (const note of notes) { for (const note of notes) {
const startDate = note.getAttributeValue("label", "startDate"); const startDate = note.getAttributeValue("label", "startDate");
const customTitle = note.getAttributeValue("label", "calendar:title"); const customTitle = note.getAttributeValue("label", "calendar:title");
const color = note.getAttributeValue("label", "calendar:color") ?? note.getAttributeValue("label", "color") ?? undefined;
if (!startDate) { if (!startDate) {
continue; continue;
@ -203,7 +204,8 @@ export default class CalendarView extends ViewMode {
title: title, title: title,
start: startDate, start: startDate,
url: `#${note.noteId}`, url: `#${note.noteId}`,
noteId: note.noteId noteId: note.noteId,
color: color,
}; };
const endDate = CalendarView.#offsetDate(note.getAttributeValue("label", "endDate") ?? startDate, 1); const endDate = CalendarView.#offsetDate(note.getAttributeValue("label", "endDate") ?? startDate, 1);