export pdf of current document

This commit is contained in:
2026-05-23 03:44:30 +10:00
parent 8a43dc597c
commit 1a2ba335ca
6 changed files with 111 additions and 3 deletions

View File

@@ -88,6 +88,11 @@ export default function App(): JSX.Element {
} else if (action === 'openProject') {
const picked = await window.api.pickProjectFolder()
if (picked) await switchProject(picked)
} else if (action === 'exportPDF') {
if (activeFilePath && activeFileContent) {
const fileName = activeFilePath.split('/').pop()?.replace(/\.md$/, '') ?? 'document'
await window.api.exportPDF(activeFileContent, fileName)
}
}
})
}, [activeFilePath, isDirty, activeFileContent, fontSize])

View File

@@ -37,6 +37,7 @@ declare global {
readConfig: () => Promise<GlobalConfig>
writeConfig: (updates: Partial<GlobalConfig>) => Promise<void>
pickProjectFolder: () => Promise<string | null>
exportPDF: (content: string, fileName: string) => Promise<void>
}
}
}