diff --git a/src/public/app/widgets/view_widgets/calendar_view.ts b/src/public/app/widgets/view_widgets/calendar_view.ts index def38b547..c9c725713 100644 --- a/src/public/app/widgets/view_widgets/calendar_view.ts +++ b/src/public/app/widgets/view_widgets/calendar_view.ts @@ -155,28 +155,7 @@ export default class CalendarView extends ViewMode { locale: await CalendarView.#getLocale(), height: "100%", nowIndicator: true, - eventContent: (e) => { - let html = ""; - const { iconClass, promotedAttributes } = e.event.extendedProps; - - // Title and icon - if (iconClass) { - html += ` `; - } - html += utils.escapeHtml(e.event.title); - - // Promoted attributes - if (promotedAttributes) { - for (const [name, value] of promotedAttributes) { - html += `\ - `; - } - } - - return { html }; - }, + eventContent: this.#buildEventContent, dateClick: async (e) => { if (!this.isCalendarRoot) { return; @@ -199,6 +178,29 @@ export default class CalendarView extends ViewMode { return this.$root; } + #buildEventContent(e: EventDropArg) { + let html = ""; + const { iconClass, promotedAttributes } = e.event.extendedProps; + + // Title and icon + if (iconClass) { + html += ` `; + } + html += utils.escapeHtml(e.event.title); + + // Promoted attributes + if (promotedAttributes) { + for (const [name, value] of promotedAttributes) { + html += `\ + `; + } + } + + return { html }; + } + static async #getLocale() { const locale = options.get("locale");