✨ export pdf of current document
This commit is contained in:
@@ -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])
|
||||
|
||||
1
src/renderer/types/global.d.ts
vendored
1
src/renderer/types/global.d.ts
vendored
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user