oops also on EPDisplay

This commit is contained in:
lingdocs 2022-07-01 20:50:18 -05:00
parent eb55b43371
commit fb374e60f8
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "3.2.0",
"version": "3.2.1",
"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

@ -1,4 +1,4 @@
import { getLength, getShort } from "../lib/p-text-helpers";
import { getLength, getLong, getShort } from "../lib/p-text-helpers";
import * as T from "../types";
import Examples from "./Examples";
@ -22,7 +22,7 @@ function CompiledPTextDisplay({ compiled, opts, justify, onlyOne, length }: {
: compiled.ps;
return <div className={justify === "left" ? "text-left" : justify === "right" ? "text-right" : "text-center"}>
{onlyOne
? <VariationLayer vs={[getShort(ps)[0]]} />
? <VariationLayer vs={[getLong(ps)[0]]} />
: "long" in ps ?
<div>
<VariationLayer vs={ps.long} />

View File

@ -9,12 +9,13 @@ import EPBlocksDisplay from "../RenderedBlocksDisplay";
import ModeSelect, { Mode, ScriptSelect } from "../DisplayModeSelect";
import { useStickyState } from "../../library";
function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne }: {
function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne, length }: {
eps: T.EPSelectionState,
opts: T.TextOptions,
setOmitSubject: ((value: "true" | "false") => void) | false
justify?: "left" | "right" | "center",
onlyOne?: boolean | "concat",
length?: "long" | "short",
}) {
const [mode, setMode] = useState<Mode>("text");
const [script, setScript] = useStickyState<"p" | "f">("f", "blockScriptChoice");
@ -54,7 +55,7 @@ function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne }: {
<div />
</div>
{mode === "text"
? <CompiledPTextDisplay opts={opts} compiled={result} justify={justify} onlyOne={!!onlyOne} />
? <CompiledPTextDisplay opts={opts} compiled={result} justify={justify} onlyOne={!!onlyOne} length={length || "short"} />
: <EPBlocksDisplay opts={opts} rendered={rendered} justify={justify} script={script} />}
{result.e && <div className={`text-muted mt-2 text-${justify === "left" ? "left" : justify === "right" ? "right" : "center"}`}>
{onlyOne === "concat"