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
fix(pdf): use server download endpoint to set note title as filename
excubitor8e3a4d7aa0e1
diff --git a/apps/client/src/widgets/type_widgets/file/Pdf.tsx b/apps/client/src/widgets/type_widgets/file/Pdf.tsxindex 582dd39693..b54e8b19cd 100644--- a/apps/client/src/widgets/type_widgets/file/Pdf.tsx+++ b/apps/client/src/widgets/type_widgets/file/Pdf.tsx@@ -189,9 +189,13 @@ export default function PdfPreview({ note, blob, componentId, noteContext }: {useTriliumEvent("customDownload", ({ ntxId }) => {if (ntxId !== noteContext.ntxId) return;- iframeRef.current?.contentWindow?.postMessage({- type: "trilium-request-download"- });++ const url = `${window.glob.baseApiUrl}notes/${note.noteId}/download?${Date.now()}`;+ if (window.electronApi) {+ window.electronApi.shell.downloadURL(url);+ } else {+ window.location.href = url;+ }});useTriliumEvent("printActiveNote", () => {