diff --git a/components/email/ComposeEmail.tsx b/components/email/ComposeEmail.tsx index 70d514b4..dafc5ab3 100644 --- a/components/email/ComposeEmail.tsx +++ b/components/email/ComposeEmail.tsx @@ -269,15 +269,10 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { setSubject(formattedEmail.subject); - // Split the formatted body to separate user's message area from quoted content + // Make the entire content editable, just like with forwarded emails const bodyContent = formattedEmail.body; + setUserMessage(bodyContent); setBody(bodyContent); - - // Set the original content for the quoted part - const quoteMatch = bodyContent.match(/
]*>([\s\S]*?)<\/blockquote>/i); - if (quoteMatch && quoteMatch[0]) { - setOriginalContent(quoteMatch[0]); - } } // Focus editor after initializing @@ -418,12 +413,12 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { ); } - // Store the complete forwarded content in state - const forwardedContent = `${headerHtml}${contentHtml}`; - setOriginalContent(forwardedContent); + // In forwarding, we'll make the entire content editable, not just the user message area + const completeContent = `
${headerHtml}${contentHtml}`; - // Set the complete body - setBody(`${forwardedContent}`); + // Don't separate original content, allow editing the entire body + setUserMessage(completeContent); + setBody(completeContent); } catch (error) { console.error('Error formatting forwarded email:', error); @@ -510,12 +505,11 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { const handleEditorInput = (e: React.FormEvent) => { if (editorRef.current) { const content = editorRef.current.innerHTML; - setUserMessage(content); - // Preserve the exact original content formatting by keeping it separate - // This ensures nested forwards maintain their structure - const combined = `${originalContent}`; - setBody(combined); + // For forwarded messages, the entire content is now editable + // No need to separate user message from original content + setUserMessage(content); + setBody(content); } }; @@ -639,7 +633,7 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { {/* Email editor with clear separation between user message and original content */} - {/* User's message input area */} + {/* Combined editable area that includes both user message and original content */} - - {/* Original content display with visual separation - only shown for replies/forwards */} - {type !== 'new' && originalContent && ( --- )}- {type === 'forward' ? 'Forwarded content' : 'Original message'} -- -