Neah version mail design fix 7 bis ?
This commit is contained in:
parent
bb57ada490
commit
6ad6c87033
@ -1149,8 +1149,42 @@ export default function MailPage() {
|
|||||||
const getReplyBody = () => {
|
const getReplyBody = () => {
|
||||||
const date = new Date(selectedEmail.date);
|
const date = new Date(selectedEmail.date);
|
||||||
const formattedDate = date.toLocaleString();
|
const formattedDate = date.toLocaleString();
|
||||||
|
|
||||||
|
// Parse the original email content
|
||||||
|
const parsed = parseFullEmail(selectedEmail.body);
|
||||||
|
let originalContent = '';
|
||||||
|
|
||||||
|
// Get the content from either HTML or text part
|
||||||
|
if (parsed.html) {
|
||||||
|
// Convert HTML to plain text for the reply
|
||||||
|
originalContent = parsed.html
|
||||||
|
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '') // Remove style tags
|
||||||
|
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '') // Remove script tags
|
||||||
|
.replace(/<[^>]+>/g, '') // Remove HTML tags
|
||||||
|
.replace(/ |‌|»|«|>/g, ' ') // Convert HTML entities to spaces
|
||||||
|
.replace(/^\s+$/gm, '') // Remove lines with only whitespace
|
||||||
|
.replace(/\n{3,}/g, '\n\n') // Normalize multiple line breaks
|
||||||
|
.trim();
|
||||||
|
} else if (parsed.text) {
|
||||||
|
originalContent = parsed.text.trim();
|
||||||
|
} else {
|
||||||
|
// Fallback to raw body if parsing fails
|
||||||
|
originalContent = selectedEmail.body
|
||||||
|
.replace(/<[^>]+>/g, '')
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format the reply
|
||||||
const separator = '\n\n------------ Original Message ------------\n';
|
const separator = '\n\n------------ Original Message ------------\n';
|
||||||
return `${separator}On ${formattedDate}, ${selectedEmail.from} wrote:\n${selectedEmail.body}`;
|
const header = `On ${formattedDate}, ${selectedEmail.from} wrote:\n`;
|
||||||
|
|
||||||
|
// Indent the original content
|
||||||
|
const indentedContent = originalContent
|
||||||
|
.split('\n')
|
||||||
|
.map(line => `> ${line}`)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
return `${separator}${header}${indentedContent}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open compose modal with reply details
|
// Open compose modal with reply details
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user