courrier preview

This commit is contained in:
alma 2025-05-01 10:17:28 +02:00
parent c4994ad175
commit 83af1599f9
2 changed files with 3 additions and 25 deletions

View File

@ -355,9 +355,7 @@ export default function ComposeEmail(props: ComposeEmailProps) {
onChange={(html) => {
// Store the content
setEmailContent(html);
// But don't update direction on every keystroke
// The RichTextEditor will handle direction changes internally
// Direction will be handled automatically by the RichTextEditor based on content
}}
className="min-h-[320px] border rounded-md bg-white text-gray-800 flex-1"
placeholder="Write your message here..."

View File

@ -93,30 +93,8 @@ const RichTextEditor = forwardRef<HTMLDivElement, RichTextEditorProps>(({
}
};
// Toggle direction manually
const toggleDirection = () => {
const newDirection = direction === 'ltr' ? 'rtl' : 'ltr';
setDirection(newDirection);
if (internalEditorRef.current) {
internalEditorRef.current.setAttribute('dir', newDirection);
}
};
return (
<div className="rich-text-editor-container">
{!readOnly && (
<div className="editor-toolbar border-b p-1 flex items-center space-x-1">
<button
type="button"
onClick={toggleDirection}
className="px-2 py-1 text-xs bg-gray-100 hover:bg-gray-200 rounded"
title={`Switch to ${direction === 'ltr' ? 'right-to-left' : 'left-to-right'} text`}
>
{direction === 'ltr' ? 'LTR → RTL' : 'RTL → LTR'}
</button>
</div>
)}
<div
ref={internalEditorRef}
contentEditable={!readOnly}
@ -147,6 +125,7 @@ const RichTextEditor = forwardRef<HTMLDivElement, RichTextEditorProps>(({
pointer-events: none;
}
/* RTL text direction is automatically handled via dir attribute */
.rich-text-editor[dir="rtl"] {
text-align: right;
}
@ -158,6 +137,7 @@ const RichTextEditor = forwardRef<HTMLDivElement, RichTextEditorProps>(({
color: #666;
}
/* Handle RTL blockquotes properly */
.rich-text-editor[dir="rtl"] blockquote {
padding-left: 0;
padding-right: 15px;