feat(views/calendar): make calendar full height

This commit is contained in:
Elian Doran 2025-02-21 17:17:53 +02:00
parent 300bb561bb
commit 710cf68c06
No known key found for this signature in database
4 changed files with 21 additions and 1 deletions

View File

@ -40,6 +40,10 @@ export default class NoteListRenderer {
}
}
get isFullHeight() {
return this.viewMode?.isFullHeight;
}
async renderList() {
if (!this.viewMode) {
return null;

View File

@ -15,6 +15,11 @@ const TPL = `
.note-list-widget .note-list {
padding: 10px;
}
.note-list-widget.full-height,
.note-list-widget.full-height .note-list-widget-content {
height: 100%;
}
</style>
<div class="note-list-widget-content">
@ -68,6 +73,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
async renderNoteList(note: FNote) {
const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds());
this.$widget.toggleClass("full-height", noteListRenderer.isFullHeight);
await noteListRenderer.renderList();
this.viewMode = noteListRenderer.viewMode;
}

View File

@ -78,6 +78,10 @@ export default class CalendarView extends ViewMode {
args.$parent.append(this.$root);
}
get isFullHeight(): boolean {
return true;
}
async renderList(): Promise<JQuery<HTMLElement> | undefined> {
const isEditable = true;
@ -98,7 +102,8 @@ export default class CalendarView extends ViewMode {
select: (e) => this.#onCalendarSelection(e),
eventChange: (e) => this.#onEventMoved(e),
firstDay: options.getInt("firstDayOfWeek") ?? 0,
locale: await CalendarView.#getLocale()
locale: await CalendarView.#getLocale(),
height: "100%"
});
calendar.render();
this.calendar = calendar;

View File

@ -21,4 +21,9 @@ export default abstract class ViewMode {
// Do nothing by default.
}
get isFullHeight() {
// Override to change its value.
return false;
}
}