🔡 fix: Rendering of Bidirectional Text (#3195)

The fix has been applied only to key components where the rendering issue is significant
This commit is contained in:
Ghaith AlHallak 2024-06-27 18:56:12 +04:00 committed by GitHub
parent ed5ee1f86f
commit 81292bb4dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 2 deletions

View file

@ -2,7 +2,10 @@ import { TMessage } from 'librechat-data-provider';
import Files from './Files';
const Container = ({ children, message }: { children: React.ReactNode; message: TMessage }) => (
<div className="text-message flex min-h-[20px] flex-col items-start gap-3 overflow-x-auto [.text-message+&]:mt-5">
<div
className="text-message flex min-h-[20px] flex-col items-start gap-3 overflow-x-auto [.text-message+&]:mt-5"
dir="auto"
>
{message.isCreatedByUser && <Files message={message} />}
{children}
</div>

View file

@ -162,6 +162,7 @@ const EditMessage = ({
contentEditable={true}
value={editedText}
suppressContentEditableWarning={true}
dir="auto"
/>
</div>
<div className="mt-2 flex w-full justify-center text-center">

View file

@ -44,6 +44,7 @@ const SearchContent = ({ message }: { message: TMessage }) => {
'markdown prose dark:prose-invert light w-full break-words',
message.isCreatedByUser ? 'whitespace-pre-wrap dark:text-gray-20' : 'dark:text-gray-70',
)}
dir="auto"
>
<MarkdownLite content={message.text ?? ''} />
</div>

View file

@ -87,6 +87,7 @@ const EditMessage = ({
contentEditable={true}
ref={textEditor}
suppressContentEditableWarning={true}
dir="auto"
>
{text}
</div>

View file

@ -72,6 +72,7 @@ const SearchBar = forwardRef((props: SearchBarProps, ref: Ref<HTMLDivElement>) =
placeholder={localize('com_nav_search_placeholder')}
onKeyUp={handleKeyUp}
autoComplete="off"
dir="auto"
/>
<X
className={cn(

View file

@ -5,6 +5,6 @@ export const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosize
(props, ref) => {
const [, setIsRerendered] = useState(false);
useLayoutEffect(() => setIsRerendered(true), []);
return <ReactTextareaAutosize {...props} ref={ref} />;
return <ReactTextareaAutosize dir="auto" {...props} ref={ref} />;
},
);