File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,25 @@ export default function HomePage() {
9191
9292 const handleExport = async ( format : "html" | "pdf" | "docx" ) => {
9393 try {
94- const result = await editor . exportAs ( format ) ;
94+ // For HTML, prompt user to choose save location
95+ let outputPath : string | undefined ;
96+ if ( format === "html" ) {
97+ try {
98+ const { save } = await import ( "@tauri-apps/plugin-dialog" ) ;
99+ const selected = await save ( {
100+ defaultPath : `${ editor . activeTab . label . replace ( / \. [ ^ / . ] + $ / , "" ) || "document" } .html` ,
101+ filters : [ { name : "HTML files" , extensions : [ "html" ] } ] ,
102+ } ) ;
103+ if ( ! selected ) return ; // User cancelled
104+ outputPath = Array . isArray ( selected ) ? selected [ 0 ] : selected ;
105+ } catch {
106+ // In browser mode, fallback to download (no save dialog)
107+ alert ( "HTML export requires Tauri desktop app for save dialog. Use download instead." ) ;
108+ return ;
109+ }
110+ }
111+ // For PDF/DOCX, export directly (backend handles temp file for now)
112+ const result = await editor . exportAs ( format , outputPath ) ;
95113 if ( result ) {
96114 alert ( `Exported to:\n${ result . path } ` ) ;
97115 }
You can’t perform that action at this time.
0 commit comments