courrier refactor rebuild preview

This commit is contained in:
alma 2025-04-27 00:29:51 +02:00
parent 9970c7b4c9
commit 685d8b4a2f

View File

@ -119,7 +119,7 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
const sender = email.from && email.from.length > 0 ? email.from[0] : undefined; const sender = email.from && email.from.length > 0 ? email.from[0] : undefined;
// Use sanitizeHtml directly, matching the approach in ComposeEmail // Use the same sanitization approach as in ComposeEmail
const sanitizedContent = sanitizeHtml(email.content || email.html || email.text || ''); const sanitizedContent = sanitizeHtml(email.content || email.html || email.text || '');
return ( return (
@ -199,25 +199,28 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
)} )}
</div> </div>
{/* Email content */} {/* Email content - updated to match ComposeEmail */}
<ScrollArea className="flex-1"> <ScrollArea className="flex-1">
<div className="px-6 py-5"> <div className="px-6 py-5">
{email.content ? ( {email.content ? (
<div <div
className={cn( className="border rounded-md overflow-hidden"
"email-content-display prose prose-sm max-w-none", style={{ minHeight: '300px' }}
!email.flags?.seen && "font-medium" >
)} <div
style={{ className="w-full p-4 focus:outline-none"
overflowWrap: 'break-word', style={{
wordBreak: 'break-word', textAlign: 'right',
textAlign: 'right' minHeight: '300px',
}} overflowWrap: 'break-word',
dir="rtl" wordBreak: 'break-word'
dangerouslySetInnerHTML={{ }}
__html: sanitizedContent dir="rtl"
}} dangerouslySetInnerHTML={{
/> __html: sanitizedContent
}}
/>
</div>
) : ( ) : (
<p className="text-muted-foreground">No content available</p> <p className="text-muted-foreground">No content available</p>
)} )}