mail page fix
This commit is contained in:
parent
4bba64dff0
commit
0a290a2a46
@ -362,11 +362,19 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st
|
|||||||
: body;
|
: body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert plain text to HTML if needed
|
// Convert plain text to HTML if needed, preserving line breaks
|
||||||
if (!contentType.includes('text/html')) {
|
if (!contentType.includes('text/html')) {
|
||||||
content = content
|
content = content
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(line => `<p>${line}</p>`)
|
.map(line => {
|
||||||
|
// Preserve empty lines
|
||||||
|
if (!line.trim()) return '<br>';
|
||||||
|
// Handle quoted text
|
||||||
|
if (line.startsWith('>')) {
|
||||||
|
return `<p class="text-gray-600">${line}</p>`;
|
||||||
|
}
|
||||||
|
return `<p>${line}</p>`;
|
||||||
|
})
|
||||||
.join('');
|
.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +412,7 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st
|
|||||||
<p><strong>Date:</strong> ${date}</p>
|
<p><strong>Date:</strong> ${date}</p>
|
||||||
<p><strong>Subject:</strong> ${email.subject}</p>
|
<p><strong>Subject:</strong> ${email.subject}</p>
|
||||||
<p><strong>To:</strong> ${Array.isArray(email.to) ? email.to.join(', ') : email.to}</p>
|
<p><strong>To:</strong> ${Array.isArray(email.to) ? email.to.join(', ') : email.to}</p>
|
||||||
<div class="mt-4">${content}</div>
|
<div class="mt-4 whitespace-pre-wrap">${content}</div>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@ -413,7 +421,7 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st
|
|||||||
<div class="prose max-w-none">
|
<div class="prose max-w-none">
|
||||||
<blockquote class="border-l-4 border-gray-300 pl-4 my-4">
|
<blockquote class="border-l-4 border-gray-300 pl-4 my-4">
|
||||||
<p>On ${date}, ${email.from} wrote:</p>
|
<p>On ${date}, ${email.from} wrote:</p>
|
||||||
<div class="mt-4">${content}</div>
|
<div class="mt-4 whitespace-pre-wrap">${content}</div>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user