From cb3e119a5dd70fa34920aecae993aff209f4904b Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 27 Apr 2025 00:37:34 +0200 Subject: [PATCH] courrier refactor rebuild preview --- components/email/EmailPreview.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/email/EmailPreview.tsx b/components/email/EmailPreview.tsx index ea3f57f5..789e8c96 100644 --- a/components/email/EmailPreview.tsx +++ b/components/email/EmailPreview.tsx @@ -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