From 269b971ac663c76917eae507763027715a917b35 Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 21 Apr 2025 15:13:56 +0200 Subject: [PATCH] mail page rest --- app/mail/page.tsx | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/app/mail/page.tsx b/app/mail/page.tsx index 5cfd3daa..a7b333c3 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -874,9 +874,31 @@ export default function CourrierPage() { return (
{/* Display HTML content if available, otherwise fallback to text */} -
+ {parsed.html ? ( +
]*>[\s\S]*?<\/style>/gi, '') + .replace(/]*>[\s\S]*?<\/script>/gi, '') + .replace(/]*>/gi, '') + .replace(/]*>/gi, '') + .replace(/]*>/gi, '') + .replace(/]*>[\s\S]*?<\/title>/gi, '') + .replace(/]*>[\s\S]*?<\/head>/gi, '') + .replace(/]*>/gi, '') + .replace(/<\/body>/gi, '') + .replace(/]*>/gi, '') + .replace(/<\/html>/gi, '') + }} + /> + ) : ( +
+ {(parsed.text || '').split('\n').map((line, i) => ( +

{line}

+ ))} +
+ )} {/* Display attachments if present */} {parsed.attachments && parsed.attachments.length > 0 && ( @@ -898,7 +920,7 @@ export default function CourrierPage() { ); } catch (e) { console.error('Error parsing email:', e); - return selectedEmail.body; + return
Error displaying email content
; } })()}