diff --git a/backend/src/controllers/exportController.ts b/backend/src/controllers/exportController.ts index 8ff1869..5c0a89d 100644 --- a/backend/src/controllers/exportController.ts +++ b/backend/src/controllers/exportController.ts @@ -21,8 +21,12 @@ export const handleExport = async (req: Request, res: Response) => { buffer = await generateDocxBuffer(text); contentType = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; extension = 'docx'; + } else if (format === 'txt') { + buffer = Buffer.from(text, 'utf-8'); + contentType = 'text/plain'; + extension = 'txt'; } else { - return res.status(400).json({ error: 'Invalid export format. Use "pdf" or "docx".' }); + return res.status(400).json({ error: 'Invalid export format. Use "pdf", "docx", or "txt".' }); } const downloadName = `${fileName || 'humanized_text'}.${extension}`; diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 7600cae..ebbf28d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -177,7 +177,7 @@ function App() { setTimeout(() => setCopySuccess(false), 2000); }; - const handleExport = async (format: 'pdf' | 'docx') => { + const handleExport = async (format: 'pdf' | 'docx' | 'txt') => { if (!humanizedText) { alert('Please generate content first before exporting.'); return; @@ -400,11 +400,18 @@ function App() { +