From 0a290a2a464344e89fd65dbdbc5420b145e73546 Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 21 Apr 2025 19:00:47 +0200 Subject: [PATCH] mail page fix --- app/courrier/page.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 0e271edd..96a52709 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -362,11 +362,19 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st : body; } - // Convert plain text to HTML if needed + // Convert plain text to HTML if needed, preserving line breaks if (!contentType.includes('text/html')) { content = content .split('\n') - .map(line => `

${line}

`) + .map(line => { + // Preserve empty lines + if (!line.trim()) return '
'; + // Handle quoted text + if (line.startsWith('>')) { + return `

${line}

`; + } + return `

${line}

`; + }) .join(''); } @@ -404,7 +412,7 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st

Date: ${date}

Subject: ${email.subject}

To: ${Array.isArray(email.to) ? email.to.join(', ') : email.to}

-
${content}
+
${content}
`; @@ -413,7 +421,7 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward'): st

On ${date}, ${email.from} wrote:

-
${content}
+
${content}
`;