diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index 4b94128d..421aa880 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -54,7 +54,13 @@ export default function ComposeEmail({ // Update the contentEditable div when composeBody changes useEffect(() => { if (composeBodyRef.current && composeBody) { - composeBodyRef.current.innerHTML = composeBody; + // Clear 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 + composeBodyRef.current.appendChild(tempDiv); } }, [composeBody]); @@ -227,7 +233,6 @@ export default function ComposeEmail({ lineHeight: 'inherit', }} onInput={handleInput} - dangerouslySetInnerHTML={{ __html: composeBody }} />