courrier clean 2$
This commit is contained in:
parent
bc5809520d
commit
b14b03877c
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -59,24 +59,14 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
|
||||
if (!email?.content) return <p>No content available</p>;
|
||||
|
||||
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 (
|
||||
<div
|
||||
className="email-content prose max-w-none dark:prose-invert"
|
||||
dangerouslySetInnerHTML={{ __html: sanitizedContent }}
|
||||
dir="auto"
|
||||
/>
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user