Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(react/type_widgets): extract full height to note types
Elian Doran763bcbd394fe
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsxindex db936228df..617380c76b 100644--- a/apps/client/src/widgets/NoteDetail.tsx+++ b/apps/client/src/widgets/NoteDetail.tsx@@ -229,7 +229,7 @@ function checkFullHeight(noteContext: NoteContext | undefined, type: ExtendedNot// https://github.com/zadam/trilium/issues/2522const isBackendNote = noteContext?.noteId === "_backendLog";const isSqlNote = noteContext.note?.mime === "text/x-sqlite;schema=trilium";- const isFullHeightNoteType = ["canvas", "webView", "noteMap", "mindMap", "mermaid", "file", "aiChat"].includes(type ?? "");+ const isFullHeightNoteType = type && TYPE_MAPPINGS[type].isFullHeight;return (!noteContext?.hasNoteList() && isFullHeightNoteType && !isSqlNote)|| noteContext?.viewScope?.viewMode === "attachments"|| isBackendNote;diff --git a/apps/client/src/widgets/note_types.tsx b/apps/client/src/widgets/note_types.tsxindex a8e3086b95..7045ac57bd 100644--- a/apps/client/src/widgets/note_types.tsx+++ b/apps/client/src/widgets/note_types.tsx@@ -21,6 +21,7 @@ interface NoteTypeMapping {printable?: boolean;/** The class name to assign to the note type wrapper */className: string;+ isFullHeight?: boolean;}export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {@@ -56,12 +57,14 @@ export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {webView: {view: () => import("./type_widgets/WebView"),className: "note-detail-web-view",- printable: true+ printable: true,+ isFullHeight: true},file: {view: () => import("./type_widgets/File"),className: "note-detail-file",- printable: true+ printable: true,+ isFullHeight: true},image: {view: () => import("./type_widgets/Image"),@@ -81,12 +84,14 @@ export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {mermaid: {view: () => import("./type_widgets/Mermaid"),className: "note-detail-mermaid",- printable: true+ printable: true,+ isFullHeight: true},mindMap: {view: () => import("./type_widgets/MindMap"),className: "note-detail-mind-map",- printable: true+ printable: true,+ isFullHeight: true},attachmentList: {view: async () => (await import("./type_widgets/Attachment")).AttachmentList,@@ -115,7 +120,8 @@ export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {canvas: {view: () => import("./type_widgets/Canvas"),className: "note-detail-canvas",- printable: true+ printable: true,+ isFullHeight: true},relationMap: {view: () => import("./type_widgets/relation_map/RelationMap"),@@ -125,10 +131,12 @@ export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {noteMap: {view: () => import("./type_widgets/NoteMap"),className: "note-detail-note-map",- printable: true+ printable: true,+ isFullHeight: true},aiChat: {view: () => import("./type_widgets/AiChat"),- className: "ai-chat-widget-container"+ className: "ai-chat-widget-container",+ isFullHeight: true}};