From 30684cb3b93a29b3ec008f1d02fcfd332cbe01fa Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 21 Apr 2025 22:08:48 +0200 Subject: [PATCH] mail page fix design --- app/courrier/page.tsx | 7 ++- components/ComposeEmail.tsx | 115 +++++++++++++++++------------------- lib/compose-mime-decoder.ts | 31 +++------- 3 files changed, 67 insertions(+), 86 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 97b5e98b..ed935087 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -1433,10 +1433,11 @@ export default function CourrierPage() { // Get the formatted original email content const originalContent = getReplyBody(selectedEmail, type); - - // Format with clear separator + + // Create a clean structure with clear separation const formattedContent = ` -
+
+
${originalContent}
`; diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index 69d757d3..2a7af66e 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -57,60 +57,65 @@ export default function ComposeEmail({ originalEmail }: ComposeEmailProps) { const composeBodyRef = useRef(null); - const newReplyRef = useRef(null); - const [showOriginalContent, setShowOriginalContent] = useState(true); - + const [localContent, setLocalContent] = useState(''); + useEffect(() => { if (composeBodyRef.current) { - const decodedContent = decodeComposeContent(composeBody); - - // Create the clear structure with proper content - composeBodyRef.current.innerHTML = ` -
- - `; - - // Place cursor in the new reply area - const newReplyArea = composeBodyRef.current.querySelector('#new-reply-area'); - if (newReplyArea) { - const range = document.createRange(); - const sel = window.getSelection(); - range.setStart(newReplyArea, 0); - range.collapse(true); - sel?.removeAllRanges(); - sel?.addRange(range); - } - } - }, [composeBody]); - - // Enhanced input handler to prevent text reversal - const handleInput = (e: React.FormEvent) => { - if (composeBodyRef.current) { - // Get the current HTML content - const fullContent = e.currentTarget.innerHTML; - - // Split at the divider to separate new reply from original content - const parts = fullContent.split('