courrier clean 2$

This commit is contained in:
alma 2025-04-26 22:05:41 +02:00
parent e95f078bbc
commit d09d8f0579
2 changed files with 13 additions and 8 deletions

View File

@ -186,9 +186,12 @@ export default function ComposeEmail(props: ComposeEmailAllProps) {
setEmailContent(content);
}
// Create a local variable to avoid type comparison issues
const isNewEmail = type === 'new';
// Focus editor after initializing content
setTimeout(() => {
if (editorRef.current && type !== 'new') {
if (!isNewEmail && editorRef.current) {
// For replies/forwards, focus contentEditable
editorRef.current.focus();
@ -453,9 +456,9 @@ export default function ComposeEmail(props: ComposeEmailAllProps) {
className="w-full p-4 min-h-[300px] focus:outline-none"
onInput={handleEditorInput}
dangerouslySetInnerHTML={{ __html: emailContent }}
dir="auto"
dir="rtl"
style={{
textAlign: 'initial',
textAlign: 'right',
}}
/>
</div>

View File

@ -157,7 +157,7 @@ export function formatForwardedEmail(email: EmailMessage): {
// Create formatted content for forwarded email
const content = `
<div style="min-height: 20px;"></div>
<div style="min-height: 20px;" dir="rtl">
<div style="border-top: 1px solid #ccc; margin-top: 10px; padding-top: 10px;">
<div style="font-family: Arial, sans-serif; color: #333;">
<div style="margin-bottom: 15px;">
@ -167,11 +167,12 @@ export function formatForwardedEmail(email: EmailMessage): {
<div><b>Subject:</b> ${email.subject || ''}</div>
<div><b>To:</b> ${toString}</div>
</div>
<div class="email-original-content" dir="auto">
<div class="email-original-content" dir="rtl">
${originalContent}
</div>
</div>
</div>
</div>
`;
return { subject, content };
@ -232,15 +233,16 @@ export function formatReplyEmail(email: EmailMessage, type: 'reply' | 'reply-all
// Format content for reply
const content = `
<div style="min-height: 20px;"></div>
<div style="min-height: 20px;" dir="rtl">
<div class="reply-body">
<div class="quote-header" style="color: #555; font-size: 13px; margin: 20px 0 10px 0;">${quoteHeader}</div>
<blockquote style="margin: 0; padding: 10px 0 10px 15px; border-left: 3px solid #ddd; color: #555; background-color: #f8f8f8; border-radius: 4px;">
<div class="quoted-content" style="font-size: 13px;" dir="auto">
<div class="quoted-content" style="font-size: 13px;" dir="rtl">
${quotedContent}
</div>
</blockquote>
</div>
</div>
`;
return {
@ -308,7 +310,7 @@ export async function decodeComposeContent(content: string): Promise<{
const parsed = await response.json();
// Apply LTR sanitization to the parsed content
// Sanitize the parsed content while preserving text direction
return {
html: parsed.html ? sanitizeHtml(parsed.html) : null,
text: parsed.text || null