Skip to content

Build your personal knowledge base with Trilium Notes

feat(book/table): display even if empty

Elian Dorandcb4ebe5d9b4
diff --git a/apps/client/src/components/note_context.ts b/apps/client/src/components/note_context.ts
index 3a8a543100..020817073e 100644
--- a/apps/client/src/components/note_context.ts
+++ b/apps/client/src/components/note_context.ts
@@ -315,14 +315,38 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
}
hasNoteList() {
- return (
- this.note &&
- ["default", "contextual-help"].includes(this.viewScope?.viewMode ?? "") &&
- (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")
- );
+ const note = this.note;
+
+ if (!note) {
+ return false;
+ }
+
+ if (!["default", "contextual-help"].includes(this.viewScope?.viewMode ?? "")) {
+ return false;
+ }
+
+ // Some book types must always display a note list, even if no children.
+ if (["calendar", "table"].includes(note.getLabelValue("viewType") ?? "")) {
+ return true;
+ }
+
+ if (!note.hasChildren()) {
+ return false;
+ }
+
+ if (!["book", "text", "code"].includes(note.type)) {
+ return false;
+ }
+
+ if (note.mime === "text/x-sqlite;schema=trilium") {
+ return false;
+ }
+
+ if (note.isLabelTruthy("hideChildrenOverview")) {
+ return false;
+ }
+
+ return true;
}
async getTextEditor(callback?: GetTextEditorCallback) {