courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 21:17:41 +02:00
parent 6fe809a74b
commit 727f87343d
2 changed files with 37 additions and 15 deletions

View File

@ -79,15 +79,38 @@ export default function EmailPanel({
console.log('EmailPanel: Raw email:', email);
// Format the email content while preserving the original structure
const formattedContent = formatEmailContent(email);
console.log('EmailPanel: Formatted content:', formattedContent);
// If content is already an object with html/text, use it directly
if (email.content && typeof email.content === 'object') {
console.log('EmailPanel: Using existing content object');
return {
...email,
content: {
html: email.content.html || email.html || '',
text: email.content.text || email.text || ''
}
};
}
// If content is a string, format it
if (typeof email.content === 'string') {
console.log('EmailPanel: Formatting string content');
const formattedContent = formatEmailContent(email);
return {
...email,
content: {
html: formattedContent,
text: email.text || email.content
}
};
}
// Fallback to html/text properties
console.log('EmailPanel: Using html/text properties');
return {
...email,
content: {
html: formattedContent,
text: email.content?.text || email.text || ''
html: email.html || '',
text: email.text || ''
}
};
}, [email]);

View File

@ -118,21 +118,20 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
// Get the content in order of preference
let content = '';
// If content is an object with html/text
if (email.content && typeof email.content === 'object') {
console.log('EmailPreview: Using object content:', email.content);
content = email.content.html || email.content.text || '';
} else if (typeof email.content === 'string') {
}
// If content is a string
else if (typeof email.content === 'string') {
console.log('EmailPreview: Using direct string content');
content = email.content;
} else if (email.html) {
console.log('EmailPreview: Using html content');
content = email.html;
} else if (email.text) {
console.log('EmailPreview: Using text content');
content = email.text;
} else if (email.formattedContent) {
console.log('EmailPreview: Using formattedContent');
content = email.formattedContent;
}
// Fallback to html/text properties
else {
console.log('EmailPreview: Using html/text properties');
content = email.html || email.text || '';
}
console.log('EmailPreview: Content before sanitization:', content);