From 401a0c44269e8ef593621911182a66e197be85c2 Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 21 Apr 2025 20:10:02 +0200 Subject: [PATCH] mail page fix design --- components/ComposeEmail.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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" />