mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	fix(calendar_view): display hours in calendar view
This commit is contained in:
		
							parent
							
								
									eea141225d
								
							
						
					
					
						commit
						b1c8e625b2
					
				@ -155,7 +155,31 @@ export default class CalendarView extends ViewMode {
 | 
				
			|||||||
            locale: await CalendarView.#getLocale(),
 | 
					            locale: await CalendarView.#getLocale(),
 | 
				
			||||||
            height: "100%",
 | 
					            height: "100%",
 | 
				
			||||||
            nowIndicator: true,
 | 
					            nowIndicator: true,
 | 
				
			||||||
            eventContent: this.#buildEventContent,
 | 
					            eventDidMount: (e) => {
 | 
				
			||||||
 | 
					                const { iconClass, promotedAttributes } = e.event.extendedProps;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // Append promoted attributes to the end of the event container.
 | 
				
			||||||
 | 
					                if (promotedAttributes) {
 | 
				
			||||||
 | 
					                    let promotedAttributesHtml = "";
 | 
				
			||||||
 | 
					                    for (const [name, value] of promotedAttributes) {
 | 
				
			||||||
 | 
					                        promotedAttributesHtml = /*html*/`\
 | 
				
			||||||
 | 
					                        <div class="promoted-attribute">
 | 
				
			||||||
 | 
					                            <span class="promoted-attribute-name">${name}</span>: <span class="promoted-attribute-value">${value}</span>
 | 
				
			||||||
 | 
					                        </div>`;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    let mainContainer;
 | 
				
			||||||
 | 
					                    switch (e.view.type) {
 | 
				
			||||||
 | 
					                        case "timeGridWeek":
 | 
				
			||||||
 | 
					                            mainContainer = e.el.querySelector(".fc-event-main");
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case "listMonth":
 | 
				
			||||||
 | 
					                            mainContainer = e.el.querySelector(".fc-list-event-title");
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    $(mainContainer ?? e.el).append($(promotedAttributesHtml));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            dateClick: async (e) => {
 | 
					            dateClick: async (e) => {
 | 
				
			||||||
                if (!this.isCalendarRoot) {
 | 
					                if (!this.isCalendarRoot) {
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
@ -178,29 +202,6 @@ export default class CalendarView extends ViewMode {
 | 
				
			|||||||
        return this.$root;
 | 
					        return this.$root;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #buildEventContent(e: EventDropArg) {
 | 
					 | 
				
			||||||
        let html = "";
 | 
					 | 
				
			||||||
        const { iconClass, promotedAttributes } = e.event.extendedProps;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Title and icon
 | 
					 | 
				
			||||||
        if (iconClass) {
 | 
					 | 
				
			||||||
            html += `<span class="${iconClass}"></span> `;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        html += utils.escapeHtml(e.event.title);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Promoted attributes
 | 
					 | 
				
			||||||
        if (promotedAttributes) {
 | 
					 | 
				
			||||||
            for (const [name, value] of promotedAttributes) {
 | 
					 | 
				
			||||||
                html += `\
 | 
					 | 
				
			||||||
                <div class="promoted-attribute">
 | 
					 | 
				
			||||||
                    <span class="promoted-attribute-name">${name}</span>: <span class="promoted-attribute-value">${value}</span>
 | 
					 | 
				
			||||||
                </div>`;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return { html };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    static async #getLocale() {
 | 
					    static async #getLocale() {
 | 
				
			||||||
        const locale = options.get("locale");
 | 
					        const locale = options.get("locale");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user