Skip to content

Build your personal knowledge base with Trilium Notes

feat(client/print): automatically apply right query param

Elian Doran750c4104f7b5
diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx
index 297b7f0e5e..82d0a47cd0 100644
--- a/apps/client/src/widgets/collections/presentation/index.tsx
+++ b/apps/client/src/widgets/collections/presentation/index.tsx
@@ -51,7 +51,12 @@ export default function PresentationView({ note, noteIds, media }: ViewModeProps
<ButtonOverlay containerRef={containerRef} api={api} />
</>
)
- } else {
+ } else if (media === "print") {
+ // Printing needs a query parameter that is read by Reveal.js.
+ const url = new URL(window.location.href);
+ url.searchParams.set("print-pdf", "");
+ window.history.replaceState({}, '', url);
+
// Shadow DOM doesn't work well with Reveal.js's PDF printing mechanism.
return content;
}