bug where we lost the rtl direction on JSX Pashto text

This commit is contained in:
lingdocs 2021-06-24 12:51:52 +04:00
parent cdea37e024
commit 23b7b5d45a
3 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "0.4.5",
"version": "0.4.6",
"author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com",

View File

@ -27,19 +27,21 @@ const Pashto = ({ opts, children: text }: {
? p
: convertAfToPkSpelling(p);
}
if (typeof text.p !== "string" && typeof text.f !== "string") {
return psJSXMap(
text as T.PsJSX,
"p",
(ps: T.PsString) => convertText(ps, opts),
);
}
const style = opts.pTextSize === "normal"
? undefined
: { fontSize: opts.pTextSize === "larger" ? "large" : "larger" };
return (
<span className="p-text" dir="rtl" style={style}>
{convertText(text as T.PsString, opts)}
{(typeof text.p !== "string" && typeof text.f !== "string")
?
psJSXMap(
text as T.PsJSX,
"p",
(ps: T.PsString) => convertText(ps, opts),
)
:
convertText(text as T.PsString, opts)
}
</span>
);
};

View File

@ -28,12 +28,10 @@ const Phonetics = ({ opts, children: text }: {
system: opts.phonetics,
})
);
if (typeof text !== "string" && typeof text.f !== "string") {
return psJSXMap(text as T.PsJSX, "f", ({f}) => handleText(f));
}
const f = typeof text === "string" ? text : text.f as string;
return <span className="f-text">
{handleText(f)}
{(typeof text !== "string" && typeof text.f !== "string")
? psJSXMap(text as T.PsJSX, "f", ({f}) => handleText(f))
: handleText(typeof text === "string" ? text : text.f as string)}
</span>
};