courrier multi account restore compose
This commit is contained in:
parent
7963852af6
commit
7d331cf87c
@ -70,26 +70,23 @@ export default function EmailPanel({
|
|||||||
const [isComposing, setIsComposing] = useState<boolean>(false);
|
const [isComposing, setIsComposing] = useState<boolean>(false);
|
||||||
const [composeType, setComposeType] = useState<'new' | 'reply' | 'reply-all' | 'forward'>('new');
|
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(() => {
|
const formattedEmail = useMemo(() => {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
console.log('EmailPanel: No email provided');
|
console.log('EmailPanel: No email provided');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
console.log('EmailPanel: Raw email:', email);
|
||||||
const content = formatEmailContent(email);
|
|
||||||
|
// Format the email content
|
||||||
// Return a new email object with the formatted content
|
const formattedContent = formatEmailContent(email);
|
||||||
return {
|
console.log('EmailPanel: Formatted content:', formattedContent);
|
||||||
...email,
|
|
||||||
content,
|
return {
|
||||||
formattedContent: content
|
...email,
|
||||||
};
|
content: formattedContent
|
||||||
} catch (error) {
|
};
|
||||||
console.error('EmailPanel: Error formatting email content:', error);
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
}, [email]);
|
}, [email]);
|
||||||
|
|
||||||
// Debounced email fetch
|
// Debounced email fetch
|
||||||
|
|||||||
@ -140,7 +140,8 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
|
|||||||
// Sanitize the content for display
|
// Sanitize the content for display
|
||||||
const sanitizedContent = DOMPurify.sanitize(content, {
|
const sanitizedContent = DOMPurify.sanitize(content, {
|
||||||
ADD_TAGS: ['style'],
|
ADD_TAGS: ['style'],
|
||||||
ADD_ATTR: ['class', 'style']
|
ADD_ATTR: ['class', 'style', 'dir'],
|
||||||
|
ALLOW_DATA_ATTR: false
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('EmailPreview: Final sanitized content:', sanitizedContent);
|
console.log('EmailPreview: Final sanitized content:', sanitizedContent);
|
||||||
|
|||||||
@ -38,8 +38,8 @@ export function formatEmailContent(email: any): string {
|
|||||||
|
|
||||||
// Sanitize the content for display while preserving formatting
|
// Sanitize the content for display while preserving formatting
|
||||||
const sanitizedContent = DOMPurify.sanitize(content, {
|
const sanitizedContent = DOMPurify.sanitize(content, {
|
||||||
ADD_TAGS: ['style'],
|
ADD_TAGS: ['style', 'table', 'thead', 'tbody', 'tr', 'td', 'th'],
|
||||||
ADD_ATTR: ['class', 'style', 'dir'],
|
ADD_ATTR: ['class', 'style', 'dir', 'colspan', 'rowspan'],
|
||||||
ALLOW_DATA_ATTR: false
|
ALLOW_DATA_ATTR: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user