diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index eb08d6a4..bc0614dc 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -132,6 +132,19 @@ export default function ComposeEmail({ // Parse the email to get headers and content - using the same function as panel 3 const decoded = await decodeEmail(emailToProcess.content); + // This is exactly how panel 3 handles email content - simple sanitization of HTML or showing text + let cleanContent = ''; + + if (decoded.html) { + // Just sanitize the HTML directly - same as panel 3 + cleanContent = DOMPurify.sanitize(decoded.html); + } else if (decoded.text) { + // Use whitespace-pre-wrap for text - same as panel 3 + cleanContent = `
${decoded.text}
`; + } else { + cleanContent = '
No displayable content available
'; + } + // Format the content based on reply type const quotedContent = type === 'forward' ? `
@@ -142,15 +155,15 @@ export default function ComposeEmail({ To: ${decoded.to || ''}
${decoded.cc ? `Cc: ${decoded.cc}
` : ''}
-
- ${decoded.html ? DOMPurify.sanitize(decoded.html) : (decoded.text ? `
${decoded.text}
` : 'No content available')} +
+ ${cleanContent}
` : `
On ${decoded.date ? decoded.date.toLocaleString() : new Date().toLocaleString()}, ${decoded.from || 'Unknown Sender'} wrote:
-
- ${decoded.html ? DOMPurify.sanitize(decoded.html) : (decoded.text ? `
${decoded.text}
` : 'No content available')} +
+ ${cleanContent}
`;