mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 10:15:52 +01:00
chore(client/print): render title using preact
This commit is contained in:
26
apps/client/src/print.tsx
Normal file
26
apps/client/src/print.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { JSX } from "preact/jsx-runtime";
|
||||
import FNote from "./entities/fnote";
|
||||
import { render } from "preact";
|
||||
|
||||
async function main() {
|
||||
const noteId = window.location.pathname.split("/")[2];
|
||||
const froca = (await import("./services/froca")).default;
|
||||
const note = await froca.getNote(noteId);
|
||||
|
||||
if (!note) return;
|
||||
|
||||
let el: JSX.Element | null = null;
|
||||
if (note.type === "book") {
|
||||
el = handleCollection(note);
|
||||
}
|
||||
|
||||
render(el, document.body);
|
||||
}
|
||||
|
||||
function handleCollection(note: FNote) {
|
||||
return (
|
||||
<h1>{note.title}</h1>
|
||||
);
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user