diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index f20f17b8..c824e1d0 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -54,7 +54,17 @@ export default function ComposeEmail({ useEffect(() => { if (composeBodyRef.current) { - composeBodyRef.current.innerHTML = composeBody; + // Remove any existing content + composeBodyRef.current.innerHTML = ''; + + // Create a temporary div to parse the HTML + const tempDiv = document.createElement('div'); + tempDiv.innerHTML = composeBody; + + // Append the parsed content to the contentEditable div + while (tempDiv.firstChild) { + composeBodyRef.current.appendChild(tempDiv.firstChild); + } } }, [composeBody]); @@ -219,8 +229,12 @@ export default function ComposeEmail({ contentEditable onInput={handleInput} className="w-full h-full mt-1 bg-white border border-gray-300 rounded-md p-2 text-gray-900 overflow-y-auto prose max-w-none" - style={{ minHeight: '200px' }} - dangerouslySetInnerHTML={{ __html: composeBody }} + style={{ + minHeight: '200px', + direction: 'ltr', + textAlign: 'left' + }} + dir="ltr" />