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
client/icon pack: set the file-based icon packs as full width notes
Adorian Doran31e5974b43fd
diff --git a/apps/client/src/widgets/note_wrapper.spec.ts b/apps/client/src/widgets/note_wrapper.spec.tsindex be7a3ab3bc..59cb8d5fd7 100644--- a/apps/client/src/widgets/note_wrapper.spec.ts+++ b/apps/client/src/widgets/note_wrapper.spec.ts@@ -19,6 +19,17 @@ describe("isAlwaysFullWidthByType", () => {expect(isAlwaysFullWidthByType(buildNote({ title: "Calendar", type: "search", "#viewType": "calendar" }))).toBe(true);expect(isAlwaysFullWidthByType(buildNote({ title: "List", type: "search", "#viewType": "list" }))).toBe(false);});++ it("is true for icon packs, including the file-type variant that isn't media/PDF", () => {+ const filePack = buildNote({ title: "File pack", type: "file", "#iconPack": "fp" });+ filePack.mime = "application/json";+ expect(isAlwaysFullWidthByType(filePack)).toBe(true);++ // A plain JSON file (no #iconPack) stays constrained.+ const plainJson = buildNote({ title: "Config", type: "file" });+ plainJson.mime = "application/json";+ expect(isAlwaysFullWidthByType(plainJson)).toBe(false);+ });});describe("isFullWidthNote", () => {diff --git a/apps/client/src/widgets/note_wrapper.ts b/apps/client/src/widgets/note_wrapper.tsindex 1bb7e9c43f..37712349fc 100644--- a/apps/client/src/widgets/note_wrapper.ts+++ b/apps/client/src/widgets/note_wrapper.ts@@ -118,6 +118,12 @@ export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {* UI toggle is hidden. Exported as a pure function for unit testing.*/export function isAlwaysFullWidthByType(note: FNote) {+ // Icon packs render a full-pane glyph grid; `code`-type ones are already covered below, this also+ // catches the `file`-type packs (distributable zips).+ if (note.isIconPack()) {+ return true;+ }+if (["code", "image", "mermaid", "book", "render", "canvas", "webView", "noteMap", "mindMap", "spreadsheet"].includes(note.type)) {return true;}