HTML auto direction for specific textual content

This commit is contained in:
Ahmed Rowaihi 2023-02-13 08:52:32 +03:00 committed by Alejandro Gomez
parent 9e8a8c1fac
commit 31cde43278
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
3 changed files with 9 additions and 6 deletions

View File

@ -128,7 +128,7 @@ export default function Text({ content, tags, creator, users }: TextProps) {
function transformParagraph(frag: TextFragment) {
const fragments = transformText(frag);
if (fragments.every(f => typeof f === "string")) {
return <p>{fragments}</p>;
return <p dir="auto">{fragments}</p>;
}
return <>{fragments}</>;
}

View File

@ -72,6 +72,7 @@ const Textarea = (props: TextareaProps) => {
return (
// @ts-expect-error If anybody can figure out how to type this, please do
<ReactTextareaAutocomplete
dir="auto"
{...props}
loadingComponent={() => <span>Loading...</span>}
placeholder={formatMessage(messages.NotePlaceholder)}

View File

@ -1,5 +1,5 @@
import "./ProfilePage.css";
import { useEffect, useMemo, useState } from "react";
import React, { useEffect, useMemo, useState } from "react";
import { useIntl, FormattedMessage } from "react-intl";
import { useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
@ -150,10 +150,12 @@ export default function ProfilePage() {
function bio() {
return (
aboutText.length > 0 && (
<>
<div className="details">{about}</div>
</>
aboutText.length && (
<React.Fragment>
<div dir="auto" className="details">
{about}
</div>
</React.Fragment>
)
);
}