courrier multi account restore compose
This commit is contained in:
parent
6fe809a74b
commit
727f87343d
@ -79,15 +79,38 @@ export default function EmailPanel({
|
|||||||
|
|
||||||
console.log('EmailPanel: Raw email:', email);
|
console.log('EmailPanel: Raw email:', email);
|
||||||
|
|
||||||
// Format the email content while preserving the original structure
|
// If content is already an object with html/text, use it directly
|
||||||
const formattedContent = formatEmailContent(email);
|
if (email.content && typeof email.content === 'object') {
|
||||||
console.log('EmailPanel: Formatted content:', formattedContent);
|
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 {
|
return {
|
||||||
...email,
|
...email,
|
||||||
content: {
|
content: {
|
||||||
html: formattedContent,
|
html: email.html || '',
|
||||||
text: email.content?.text || email.text || ''
|
text: email.text || ''
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [email]);
|
}, [email]);
|
||||||
|
|||||||
@ -118,21 +118,20 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP
|
|||||||
// Get the content in order of preference
|
// Get the content in order of preference
|
||||||
let content = '';
|
let content = '';
|
||||||
|
|
||||||
|
// If content is an object with html/text
|
||||||
if (email.content && typeof email.content === 'object') {
|
if (email.content && typeof email.content === 'object') {
|
||||||
console.log('EmailPreview: Using object content:', email.content);
|
console.log('EmailPreview: Using object content:', email.content);
|
||||||
content = email.content.html || email.content.text || '';
|
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');
|
console.log('EmailPreview: Using direct string content');
|
||||||
content = email.content;
|
content = email.content;
|
||||||
} else if (email.html) {
|
}
|
||||||
console.log('EmailPreview: Using html content');
|
// Fallback to html/text properties
|
||||||
content = email.html;
|
else {
|
||||||
} else if (email.text) {
|
console.log('EmailPreview: Using html/text properties');
|
||||||
console.log('EmailPreview: Using text content');
|
content = email.html || email.text || '';
|
||||||
content = email.text;
|
|
||||||
} else if (email.formattedContent) {
|
|
||||||
console.log('EmailPreview: Using formattedContent');
|
|
||||||
content = email.formattedContent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('EmailPreview: Content before sanitization:', content);
|
console.log('EmailPreview: Content before sanitization:', content);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user