mail page fix design

This commit is contained in:
alma 2025-04-21 21:24:22 +02:00
parent 68c1936690
commit 448f34e655

View File

@ -62,14 +62,21 @@ export default function ComposeEmail({
useEffect(() => { useEffect(() => {
if (composeBodyRef.current) { if (composeBodyRef.current) {
const decodedContent = decodeComposeContent(composeBody); const decodedContent = decodeComposeContent(composeBody);
composeBodyRef.current.innerHTML = `<br/><br/>${decodedContent}`; composeBodyRef.current.innerHTML = `
<div style="min-height: 20px;"></div>
<div style="white-space: pre-wrap; word-wrap: break-word;">
${decodedContent}
</div>
`;
const range = document.createRange(); const range = document.createRange();
const sel = window.getSelection(); const sel = window.getSelection();
range.setStart(composeBodyRef.current, 0); if (composeBodyRef.current.firstChild) {
range.setStart(composeBodyRef.current.firstChild, 0);
range.collapse(true); range.collapse(true);
sel?.removeAllRanges(); sel?.removeAllRanges();
sel?.addRange(range); sel?.addRange(range);
} }
}
}, [composeBody]); }, [composeBody]);
const handleInput = (e: React.FormEvent<HTMLDivElement>) => { const handleInput = (e: React.FormEvent<HTMLDivElement>) => {
@ -259,8 +266,10 @@ export default function ComposeEmail({
className="w-full h-full mt-1 bg-white border border-gray-300 rounded-md p-2 text-gray-900 overflow-y-auto" className="w-full h-full mt-1 bg-white border border-gray-300 rounded-md p-2 text-gray-900 overflow-y-auto"
style={{ style={{
minHeight: '200px', minHeight: '200px',
writingMode: 'horizontal-tb', whiteSpace: 'pre-wrap',
direction: 'ltr' wordWrap: 'break-word',
overflowWrap: 'break-word',
writingMode: 'horizontal-tb'
}} }}
/> />
</div> </div>