mail page fix

This commit is contained in:
alma 2025-04-21 16:31:07 +02:00
parent 0cfc45f13a
commit 192ae462de

View File

@ -432,37 +432,24 @@ function getReplyBody(email: Email | null, type: 'reply' | 'replyAll' | 'forward
const subject = email.subject || '(No subject)';
if (type === 'forward') {
if (isHtml) {
return `---------- Forwarded message ---------<br>
From: ${from}<br>
Date: ${formattedDate}<br>
Subject: ${subject}<br>
To: ${email.to}<br>
<br>
${content}`;
} else {
return `---------- Forwarded message ---------
return `---------- Forwarded message ---------
From: ${from}
Date: ${formattedDate}
Subject: ${subject}
To: ${email.to}
${content}`;
}
} else {
if (isHtml) {
return `<br><br>
<div class="email-quote">
<div class="email-quote-header">
On ${formattedDate}, ${from} wrote:
</div>
<div class="email-quote-content">
${content}
</div>
</div>`;
// For HTML content, wrap each line in a blockquote
const quotedHtml = content
.split('\n')
.map(line => `<blockquote>${line}</blockquote>`)
.join('\n');
return `\n\nOn ${formattedDate}, ${from} wrote:\n${quotedHtml}`;
} else {
return `\n\nOn ${formattedDate}, ${from} wrote:
> ${content.split('\n').join('\n> ')}`;
return `\n\nOn ${formattedDate}, ${from} wrote:\n> ${content.split('\n').join('\n> ')}`;
}
}
} catch (error) {
@ -1780,12 +1767,13 @@ export default function CourrierPage() {
{/* Message Body */}
<div>
<Label htmlFor="message" className="block text-sm font-medium text-gray-700">Message</Label>
<Textarea
<div
id="message"
value={composeBody}
onChange={(e) => setComposeBody(e.target.value)}
placeholder="Write your message..."
className="w-full mt-1 min-h-[200px] bg-white border-gray-300 text-gray-900 resize-none"
contentEditable
dangerouslySetInnerHTML={{ __html: composeBody }}
onInput={(e) => setComposeBody(e.currentTarget.innerHTML)}
className="w-full mt-1 min-h-[200px] bg-white border border-gray-300 text-gray-900 p-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
style={{ whiteSpace: 'pre-wrap' }}
/>
</div>
</div>