Skip to content

Build your personal knowledge base with Trilium Notes

fix(client/print): title interfering with presentation

Elian Dorandf176c4e4ab6
diff --git a/apps/client/src/print.tsx b/apps/client/src/print.tsx
index 5bfd0d5f1c..dda6ae2b26 100644
--- a/apps/client/src/print.tsx
+++ b/apps/client/src/print.tsx
@@ -1,4 +1,3 @@
-import { JSX } from "preact/jsx-runtime";
import FNote from "./entities/fnote";
import { render } from "preact";
import { CustomNoteList } from "./widgets/collections/NoteList";
@@ -10,31 +9,26 @@ async function main() {
const note = await froca.getNote(noteId);
if (!note) return;
-
- let el: JSX.Element | null = null;
- if (note.type === "book") {
- el = handleCollection(note);
- }
-
- render((
- <>
- <h1>{note.title}</h1>
- {el}
- </>
- ), document.body);
+ render(getElementForNote(note), document.body);
}
-function handleCollection(note: FNote) {
- return (
- <CustomNoteList
+function getElementForNote(note: FNote) {
+ // Collections.
+ if (note.type === "book") {
+ return <CustomNoteList
isEnabled
note={note}
notePath={note.getBestNotePath().join("/")}
ntxId="print"
highlightedTokens={null}
media="print"
- />
- );
+ />;
+ }
+
+ // Other note types.
+ return <>
+ <h1>{note.title}</h1>
+ </>;
}
main();