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