courrier refactor rebuild preview

This commit is contained in:
alma 2025-04-27 00:37:34 +02:00
parent 88e03326af
commit cb3e119a5d

View File

@ -123,14 +123,17 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
hasAttachments: email.hasAttachments || false
};
// Get the raw content - this is what we'd normally display directly
// Get the raw content directly
const rawContent = email.content || email.html || email.text || '';
// Log both raw and formatted content for debugging
console.log("Raw content:", rawContent.substring(0, 200));
// Now use the same content that would be shown in a reply
// This is exactly what ComposeEmail shows
const { content } = formatReplyEmail(formatterEmail, 'reply');
// Use the same formatters that ComposeEmail uses
setFormattedContent(rawContent);
console.log("Formatted content for display:", content.substring(0, 200));
// Use the formatted content that includes the proper structure
setFormattedContent(content);
} catch (error) {
console.error('Error formatting email content:', error);
// Fallback to raw content if formatting fails