Skip to content

Commit b4ce826

Browse files
committed
fix export html issue
1 parent c373721 commit b4ce826

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

frontend/src/app/page.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)