Skip to content

Build your personal knowledge base with Trilium Notes

feat(view/calendar): improve display when creating empty note

Elian Doran169b2269b166
diff --git a/src/public/app/components/note_context.ts b/src/public/app/components/note_context.ts
index 7656894c94..6179ac57ff 100644
--- a/src/public/app/components/note_context.ts
+++ b/src/public/app/components/note_context.ts
@@ -290,7 +290,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
return (
this.note &&
["default", "contextual-help"].includes(this.viewScope?.viewMode ?? "") &&
- this.note.hasChildren() &&
+ (this.note.hasChildren() || this.note.getLabelValue("viewType") === "calendar") &&
["book", "text", "code"].includes(this.note.type) &&
this.note.mime !== "text/x-sqlite;schema=trilium" &&
!this.note.isLabelTruthy("hideChildrenOverview")
diff --git a/src/public/app/widgets/note_list.ts b/src/public/app/widgets/note_list.ts
index b1cfd06d9f..2775aea78e 100644
--- a/src/public/app/widgets/note_list.ts
+++ b/src/public/app/widgets/note_list.ts
@@ -107,8 +107,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
entitiesReloadedEvent(e: EventData<"entitiesReloaded">) {
if (e.loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId && attr.name && ["viewType", "expanded", "pageSize"].includes(attr.name))) {
- this.shownNoteId = null; // force render
-
+ this.refresh();
this.checkRenderStatus();
}
diff --git a/src/public/app/widgets/type_widgets/book.ts b/src/public/app/widgets/type_widgets/book.ts
index bb872d50e9..38be2a56c6 100644
--- a/src/public/app/widgets/type_widgets/book.ts
+++ b/src/public/app/widgets/type_widgets/book.ts
@@ -1,6 +1,7 @@
import TypeWidget from "./type_widget.js";
import { t } from "../../services/i18n.js";
import type FNote from "../../entities/fnote.js";
+import type { EventData } from "../../components/app_context.js";
const TPL = `
<div class="note-detail-book note-detail-printable">
@@ -35,6 +36,15 @@ export default class BookTypeWidget extends TypeWidget {
}
async doRefresh(note: FNote) {
- this.$helpNoChildren.toggle(!this.note?.hasChildren());
+ this.$helpNoChildren.toggle(
+ !this.note?.hasChildren()
+ && this.note?.getAttributeValue("label", "viewType") !== "calendar");
}
+
+ entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
+ if (loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId && attr.name === "viewType")) {
+ this.refresh();
+ }
+ }
+
}