mime change
This commit is contained in:
parent
ea2193ed9a
commit
591966284d
@ -83,26 +83,39 @@ export default function ComposeEmail({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (composeBodyRef.current && !isInitialized) {
|
if (composeBodyRef.current && !isInitialized) {
|
||||||
// Initialize the content structure with both new reply area and original content in a single contentEditable div
|
let content = '';
|
||||||
const content = replyTo || forwardFrom ? `
|
|
||||||
<div class="compose-area" contenteditable="true">${initialBody || ''}</div>
|
if (replyTo || forwardFrom) {
|
||||||
<div class="quoted-content" contenteditable="false">
|
// Get the original email content
|
||||||
|
const originalContent = replyTo?.body || forwardFrom?.body || '';
|
||||||
|
|
||||||
|
// Create the reply/forward structure
|
||||||
|
content = `
|
||||||
|
<div class="compose-area" contenteditable="true" style="min-height: 100px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 4px; margin-bottom: 20px;"></div>
|
||||||
|
<div class="quoted-content" contenteditable="false" style="color: #6b7280; font-size: 0.875rem;">
|
||||||
${forwardFrom ? `
|
${forwardFrom ? `
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
---------- Forwarded message ---------<br/>
|
---------- Forwarded message ---------<br/>
|
||||||
From: ${forwardFrom.from}<br/>
|
From: ${forwardFrom.from}<br/>
|
||||||
Date: ${new Date(forwardFrom.date).toLocaleString()}<br/>
|
Date: ${new Date(forwardFrom.date).toLocaleString()}<br/>
|
||||||
Subject: ${forwardFrom.subject}<br/>
|
Subject: ${forwardFrom.subject}<br/>
|
||||||
To: ${forwardFrom.to}<br/>
|
To: ${forwardFrom.to}<br/>
|
||||||
${forwardFrom.cc ? `Cc: ${forwardFrom.cc}<br/>` : ''}
|
${forwardFrom.cc ? `Cc: ${forwardFrom.cc}<br/>` : ''}
|
||||||
<br/>
|
</div>
|
||||||
` : `
|
` : `
|
||||||
On ${new Date(replyTo?.date || '').toLocaleString()}, ${replyTo?.from} wrote:<br/>
|
<div style="margin-bottom: 10px;">
|
||||||
|
On ${new Date(replyTo?.date || '').toLocaleString()}, ${replyTo?.from} wrote:
|
||||||
|
</div>
|
||||||
`}
|
`}
|
||||||
<blockquote style="margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204,204,204); padding-left: 1ex;">
|
<blockquote style="margin: 0; padding-left: 1em; border-left: 2px solid #e5e7eb;">
|
||||||
${composeBody}
|
${originalContent}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
` : `<div class="compose-area" contenteditable="true">${initialBody || ''}</div>`;
|
`;
|
||||||
|
} else {
|
||||||
|
// For new messages
|
||||||
|
content = `<div class="compose-area" contenteditable="true" style="min-height: 100px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 4px;"></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
composeBodyRef.current.innerHTML = content;
|
composeBodyRef.current.innerHTML = content;
|
||||||
setIsInitialized(true);
|
setIsInitialized(true);
|
||||||
@ -119,7 +132,7 @@ export default function ComposeEmail({
|
|||||||
(composeArea as HTMLElement).focus();
|
(composeArea as HTMLElement).focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [composeBody, replyTo, forwardFrom, isInitialized, initialBody]);
|
}, [composeBody, replyTo, forwardFrom, isInitialized]);
|
||||||
|
|
||||||
// Modified input handler to work with the single contentEditable area
|
// Modified input handler to work with the single contentEditable area
|
||||||
const handleInput = (e: React.FormEvent<HTMLDivElement>) => {
|
const handleInput = (e: React.FormEvent<HTMLDivElement>) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user