diff --git a/app/globals.css b/app/globals.css index 4b2d1293..0b023abb 100644 --- a/app/globals.css +++ b/app/globals.css @@ -96,16 +96,15 @@ text-align: inherit; } -/* Email content wrapper should still force LTR for quoted content */ +/* Email content wrapper should respect natural text direction */ .email-content-wrapper { - direction: ltr !important; - unicode-bidi: isolate !important; - text-align: left !important; + direction: auto; + unicode-bidi: isolate; + text-align: initial; } .email-content-wrapper * { - direction: ltr !important; - unicode-bidi: isolate !important; - text-align: left !important; + max-width: 100%; + word-wrap: break-word; } diff --git a/components/email/EmailPreview.tsx b/components/email/EmailPreview.tsx index 84a1e7c5..d04c87ad 100644 --- a/components/email/EmailPreview.tsx +++ b/components/email/EmailPreview.tsx @@ -59,24 +59,14 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP if (!email?.content) return
No content available
; try { - // Use DOMPurify directly with enhanced sanitization options - const sanitizedContent = DOMPurify.sanitize(email.content, { - ADD_TAGS: ['style', 'meta', 'link', 'table', 'thead', 'tbody', 'tr', 'td', 'th', 'hr', 'font', 'div', 'span', 'a', 'img', 'b', 'strong', 'i', 'em', 'u', 'br', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'pre', 'code', 'center', 'section', 'header', 'footer', 'article', 'nav', 'keyframes'], - ADD_ATTR: ['*', 'colspan', 'rowspan', 'cellpadding', 'cellspacing', 'border', 'bgcolor', 'width', 'height', 'align', 'valign', 'class', 'id', 'style', 'color', 'face', 'size', 'background', 'src', 'href', 'target', 'rel', 'alt', 'title', 'name', 'animation', 'animation-name', 'animation-duration', 'animation-fill-mode'], - ALLOW_UNKNOWN_PROTOCOLS: true, - WHOLE_DOCUMENT: true, - KEEP_CONTENT: true, - RETURN_DOM: false, - FORBID_TAGS: ['script', 'iframe', 'object', 'embed', 'form', 'input', 'button', 'select', 'option', 'textarea', 'canvas', 'video', 'audio'], - FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover', 'onmouseout', 'onchange', 'onsubmit'], - USE_PROFILES: { html: true, svg: false, svgFilters: false, mathMl: false }, - FORCE_BODY: true - }); + // Use the centralized sanitizeHtml function which preserves direction + const sanitizedContent = sanitizeHtml(email.content); return ( ); } catch (error) {