courrier preview
This commit is contained in:
parent
c4994ad175
commit
83af1599f9
@ -355,9 +355,7 @@ export default function ComposeEmail(props: ComposeEmailProps) {
|
|||||||
onChange={(html) => {
|
onChange={(html) => {
|
||||||
// Store the content
|
// Store the content
|
||||||
setEmailContent(html);
|
setEmailContent(html);
|
||||||
|
// Direction will be handled automatically by the RichTextEditor based on content
|
||||||
// But don't update direction on every keystroke
|
|
||||||
// The RichTextEditor will handle direction changes internally
|
|
||||||
}}
|
}}
|
||||||
className="min-h-[320px] border rounded-md bg-white text-gray-800 flex-1"
|
className="min-h-[320px] border rounded-md bg-white text-gray-800 flex-1"
|
||||||
placeholder="Write your message here..."
|
placeholder="Write your message here..."
|
||||||
|
|||||||
@ -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 (
|
return (
|
||||||
<div className="rich-text-editor-container">
|
<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
|
<div
|
||||||
ref={internalEditorRef}
|
ref={internalEditorRef}
|
||||||
contentEditable={!readOnly}
|
contentEditable={!readOnly}
|
||||||
@ -147,6 +125,7 @@ const RichTextEditor = forwardRef<HTMLDivElement, RichTextEditorProps>(({
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* RTL text direction is automatically handled via dir attribute */
|
||||||
.rich-text-editor[dir="rtl"] {
|
.rich-text-editor[dir="rtl"] {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
@ -158,6 +137,7 @@ const RichTextEditor = forwardRef<HTMLDivElement, RichTextEditorProps>(({
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle RTL blockquotes properly */
|
||||||
.rich-text-editor[dir="rtl"] blockquote {
|
.rich-text-editor[dir="rtl"] blockquote {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user