diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 91e6d0d8..c1b80b3a 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -173,6 +173,7 @@ function EmailContent({ email }: { email: Email }) {
); setDebugInfo('Rendered fetched HTML content with centralized formatter'); @@ -204,6 +205,7 @@ function EmailContent({ email }: { email: Email }) {
); setDebugInfo('Rendered existing HTML content with centralized formatter'); @@ -217,13 +219,14 @@ function EmailContent({ email }: { email: Email }) {
); setDebugInfo('Rendered content as HTML using centralized formatter'); } else { // Otherwise, render as plain text setContent( -
+
{cleanedContent}
); @@ -426,7 +429,7 @@ function ReplyContent({ email, type }: { email: Email; type: 'reply' | 'reply-al return
{error}
; } - return
; + return
; } function EmailPreview({ email }: { email: Email }) { diff --git a/lib/utils/email-formatter.ts b/lib/utils/email-formatter.ts index c00941d3..9578c71b 100644 --- a/lib/utils/email-formatter.ts +++ b/lib/utils/email-formatter.ts @@ -5,7 +5,7 @@ * It provides consistent handling of email content, sanitization, and text direction. * * All code that needs to format email content should import from this file. - * Text direction is standardized to LTR (left-to-right) for consistency. + * Text direction is preserved based on content language for proper RTL/LTR display. */ import DOMPurify from 'isomorphic-dompurify'; @@ -107,14 +107,14 @@ export function formatEmailDate(date: Date | string | undefined): string { /** * Sanitize HTML content before processing or displaying - * This ensures the content is properly formatted for LTR display + * This ensures the content is properly sanitized while preserving text direction * @param content HTML content to sanitize - * @returns Sanitized HTML with LTR formatting + * @returns Sanitized HTML with preserved text direction */ export function sanitizeHtml(content: string): string { if (!content) return ''; - // Sanitize the HTML using our configured DOMPurify with LTR enforced + // Sanitize the HTML using our configured DOMPurify with text direction preserved return DOMPurify.sanitize(content); }