courrier clean 2
This commit is contained in:
parent
34d2aed721
commit
71cc875f57
@ -409,7 +409,12 @@ export default function ComposeEmail(props: ComposeEmailAllProps) {
|
|||||||
// Use the most complete version of content available
|
// Use the most complete version of content available
|
||||||
contentHtml = DOMPurify.sanitize(
|
contentHtml = DOMPurify.sanitize(
|
||||||
initialEmail.content || initialEmail.html ||
|
initialEmail.content || initialEmail.html ||
|
||||||
`<pre style="white-space: pre-wrap;">${initialEmail.text || ''}</pre>`
|
`<pre style="white-space: pre-wrap;">${initialEmail.text || ''}</pre>`,
|
||||||
|
{
|
||||||
|
ADD_ATTR: ['style', 'class'],
|
||||||
|
ALLOW_DATA_ATTR: true,
|
||||||
|
USE_PROFILES: { html: true }
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +512,8 @@ export default function ComposeEmail(props: ComposeEmailAllProps) {
|
|||||||
const content = editorRef.current.innerHTML;
|
const content = editorRef.current.innerHTML;
|
||||||
setUserMessage(content);
|
setUserMessage(content);
|
||||||
|
|
||||||
// Combine user message with original content for the full email
|
// Preserve the exact original content formatting by keeping it separate
|
||||||
|
// This ensures nested forwards maintain their structure
|
||||||
const combined = `<div class="user-message" style="direction: ${isRTL ? 'rtl' : 'ltr'}; text-align: ${isRTL ? 'right' : 'left'};">${content}</div>${originalContent}`;
|
const combined = `<div class="user-message" style="direction: ${isRTL ? 'rtl' : 'ltr'}; text-align: ${isRTL ? 'right' : 'left'};">${content}</div>${originalContent}`;
|
||||||
setBody(combined);
|
setBody(combined);
|
||||||
}
|
}
|
||||||
@ -654,7 +660,7 @@ export default function ComposeEmail(props: ComposeEmailAllProps) {
|
|||||||
<div
|
<div
|
||||||
className="p-4 bg-gray-50 text-sm original-content"
|
className="p-4 bg-gray-50 text-sm original-content"
|
||||||
dangerouslySetInnerHTML={{ __html: originalContent }}
|
dangerouslySetInnerHTML={{ __html: originalContent }}
|
||||||
style={{ opacity: 0.85 }}
|
style={{ opacity: 1.0 }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -787,7 +793,8 @@ function LegacyAdapter({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a minimal EmailMessage object with the necessary fields
|
// For forwarded content, we need to preserve all the original formatting
|
||||||
|
// The composeBody already contains the formatted message with headers
|
||||||
return {
|
return {
|
||||||
id: 'temp-id',
|
id: 'temp-id',
|
||||||
messageId: '',
|
messageId: '',
|
||||||
@ -795,6 +802,7 @@ function LegacyAdapter({
|
|||||||
from: [{ name: '', address: '' }],
|
from: [{ name: '', address: '' }],
|
||||||
to: [{ name: '', address: '' }],
|
to: [{ name: '', address: '' }],
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
|
// Always use the full composeBody to ensure nested forwards are preserved
|
||||||
content: composeBody,
|
content: composeBody,
|
||||||
html: composeBody,
|
html: composeBody,
|
||||||
hasAttachments: false
|
hasAttachments: false
|
||||||
@ -820,7 +828,18 @@ function LegacyAdapter({
|
|||||||
onCancel?.();
|
onCancel?.();
|
||||||
setShowCompose(false);
|
setShowCompose(false);
|
||||||
}}
|
}}
|
||||||
onSend={async (emailData) => {
|
onSend={async (emailData: {
|
||||||
|
to: string;
|
||||||
|
cc?: string;
|
||||||
|
bcc?: string;
|
||||||
|
subject: string;
|
||||||
|
body: string;
|
||||||
|
attachments?: Array<{
|
||||||
|
name: string;
|
||||||
|
content: string;
|
||||||
|
type: string;
|
||||||
|
}>;
|
||||||
|
}) => {
|
||||||
// Update legacy state before sending
|
// Update legacy state before sending
|
||||||
setComposeTo(emailData.to);
|
setComposeTo(emailData.to);
|
||||||
if (emailData.cc) setComposeCc(emailData.cc);
|
if (emailData.cc) setComposeCc(emailData.cc);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user