courrier refactor rebuild preview

This commit is contained in:
alma 2025-04-27 00:31:37 +02:00
parent 685d8b4a2f
commit 4ee8eb6662

View File

@ -119,8 +119,8 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
const sender = email.from && email.from.length > 0 ? email.from[0] : undefined;
// Use the same sanitization approach as in ComposeEmail
const sanitizedContent = sanitizeHtml(email.content || email.html || email.text || '');
// Use sanitizeHtml directly, matching ComposeEmail exactly
const emailContent = sanitizeHtml(email.content || email.html || email.text || '');
return (
<Card className="flex flex-col h-full overflow-hidden border-0 shadow-none">
@ -199,31 +199,20 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
)}
</div>
{/* Email content - updated to match ComposeEmail */}
{/* Email content - EXACT match with ComposeEmail */}
<ScrollArea className="flex-1">
<div className="px-6 py-5">
{email.content ? (
<div
className="border rounded-md overflow-hidden"
style={{ minHeight: '300px' }}
>
<div
className="w-full p-4 focus:outline-none"
style={{
textAlign: 'right',
minHeight: '300px',
overflowWrap: 'break-word',
wordBreak: 'break-word'
}}
dir="rtl"
dangerouslySetInnerHTML={{
__html: sanitizedContent
}}
/>
</div>
) : (
<p className="text-muted-foreground">No content available</p>
)}
<div className="p-6 space-y-4">
{/* Message content - copied exactly from ComposeEmail for reply/forward */}
<div className="border rounded-md overflow-hidden">
<div
className="w-full p-4 min-h-[300px] focus:outline-none"
dangerouslySetInnerHTML={{ __html: emailContent }}
dir="rtl"
style={{
textAlign: 'right'
}}
/>
</div>
</div>
</ScrollArea>
</Card>