From a794ca5e1b27828b990da3b7f95e72fe7b82c172 Mon Sep 17 00:00:00 2001 From: alma Date: Thu, 24 Apr 2025 17:08:15 +0200 Subject: [PATCH] mime change --- components/ComposeEmail.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index 6cdeaf2a..a2eb300d 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -85,7 +85,7 @@ export default function ComposeEmail({ if (composeBodyRef.current && !isInitialized) { // Initialize the content structure with both new reply area and original content in a single contentEditable div const content = replyTo || forwardFrom ? ` -
+
${initialBody || ''}
${forwardFrom ? ` ---------- Forwarded message ---------
@@ -102,7 +102,7 @@ export default function ComposeEmail({ ${composeBody}
- ` : ''; + ` : `
${initialBody || ''}
`; composeBodyRef.current.innerHTML = content; setIsInitialized(true); @@ -116,16 +116,18 @@ export default function ComposeEmail({ range.collapse(true); sel?.removeAllRanges(); sel?.addRange(range); + (composeArea as HTMLElement).focus(); } } - }, [composeBody, replyTo, forwardFrom, isInitialized]); + }, [composeBody, replyTo, forwardFrom, isInitialized, initialBody]); // Modified input handler to work with the single contentEditable area const handleInput = (e: React.FormEvent) => { if (!composeBodyRef.current) return; - const composeArea = composeBodyRef.current.querySelector('.compose-area'); - if (composeArea) { - setComposeBody(composeArea.innerHTML); + const content = composeBodyRef.current.innerHTML; + setComposeBody(content); + if (onBodyChange) { + onBodyChange(content); } }; @@ -271,6 +273,8 @@ export default function ComposeEmail({