mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 03:32:26 +08:00
feat(views/calendar): display event icon
This commit is contained in:
parent
fe5182ebc6
commit
81bdd57398
@ -9,6 +9,7 @@ import options from "../../services/options.js";
|
|||||||
import dialogService from "../../services/dialog.js";
|
import dialogService from "../../services/dialog.js";
|
||||||
import attributes from "../../services/attributes.js";
|
import attributes from "../../services/attributes.js";
|
||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
|
import utils from "../../services/utils.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="calendar-view">
|
<div class="calendar-view">
|
||||||
@ -105,7 +106,18 @@ export default class CalendarView extends ViewMode {
|
|||||||
weekends: !this.parentNote.hasAttribute("label", "calendar:hideWeekends"),
|
weekends: !this.parentNote.hasAttribute("label", "calendar:hideWeekends"),
|
||||||
weekNumbers: this.parentNote.hasAttribute("label", "calendar:weekNumbers"),
|
weekNumbers: this.parentNote.hasAttribute("label", "calendar:weekNumbers"),
|
||||||
locale: await CalendarView.#getLocale(),
|
locale: await CalendarView.#getLocale(),
|
||||||
height: "100%"
|
height: "100%",
|
||||||
|
eventContent: (e => {
|
||||||
|
let html = "";
|
||||||
|
|
||||||
|
const iconClass = e.event.extendedProps.iconClass;
|
||||||
|
if (iconClass) {
|
||||||
|
html += `<span class="${iconClass}"></span> `;
|
||||||
|
}
|
||||||
|
|
||||||
|
html += utils.escapeHtml(e.event.title);
|
||||||
|
return { html };
|
||||||
|
})
|
||||||
});
|
});
|
||||||
calendar.render();
|
calendar.render();
|
||||||
this.calendar = calendar;
|
this.calendar = calendar;
|
||||||
@ -219,6 +231,7 @@ export default class CalendarView extends ViewMode {
|
|||||||
url: `#${note.noteId}`,
|
url: `#${note.noteId}`,
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
color: color,
|
color: color,
|
||||||
|
iconClass: note.getLabelValue("iconClass")
|
||||||
};
|
};
|
||||||
|
|
||||||
const endDate = CalendarView.#offsetDate(note.getAttributeValue("label", "endDate") ?? startDate, 1);
|
const endDate = CalendarView.#offsetDate(note.getAttributeValue("label", "endDate") ?? startDate, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user