courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 21:12:46 +02:00
parent 7963852af6
commit 7d331cf87c
3 changed files with 15 additions and 17 deletions

View File

@ -70,26 +70,23 @@ export default function EmailPanel({
const [isComposing, setIsComposing] = useState<boolean>(false);
const [composeType, setComposeType] = useState<'new' | 'reply' | 'reply-all' | 'forward'>('new');
// Create a formatted version of the email content
// Format the email content
const formattedEmail = useMemo(() => {
if (!email) {
console.log('EmailPanel: No email provided');
return null;
}
try {
const content = formatEmailContent(email);
// Return a new email object with the formatted content
return {
...email,
content,
formattedContent: content
};
} catch (error) {
console.error('EmailPanel: Error formatting email content:', error);
return email;
}
console.log('EmailPanel: Raw email:', email);
// Format the email content
const formattedContent = formatEmailContent(email);
console.log('EmailPanel: Formatted content:', formattedContent);
return {
...email,
content: formattedContent
};
}, [email]);
// Debounced email fetch

View File

@ -140,7 +140,8 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
// Sanitize the content for display
const sanitizedContent = DOMPurify.sanitize(content, {
ADD_TAGS: ['style'],
ADD_ATTR: ['class', 'style']
ADD_ATTR: ['class', 'style', 'dir'],
ALLOW_DATA_ATTR: false
});
console.log('EmailPreview: Final sanitized content:', sanitizedContent);

View File

@ -38,8 +38,8 @@ export function formatEmailContent(email: any): string {
// Sanitize the content for display while preserving formatting
const sanitizedContent = DOMPurify.sanitize(content, {
ADD_TAGS: ['style'],
ADD_ATTR: ['class', 'style', 'dir'],
ADD_TAGS: ['style', 'table', 'thead', 'tbody', 'tr', 'td', 'th'],
ADD_ATTR: ['class', 'style', 'dir', 'colspan', 'rowspan'],
ALLOW_DATA_ATTR: false
});