oops also on EPDisplay
This commit is contained in:
parent
eb55b43371
commit
fb374e60f8
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "3.2.0",
|
"version": "3.2.1",
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||||
"homepage": "https://verbs.lingdocs.com",
|
"homepage": "https://verbs.lingdocs.com",
|
||||||
|
|
|
@ -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 * as T from "../types";
|
||||||
import Examples from "./Examples";
|
import Examples from "./Examples";
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ function CompiledPTextDisplay({ compiled, opts, justify, onlyOne, length }: {
|
||||||
: compiled.ps;
|
: compiled.ps;
|
||||||
return <div className={justify === "left" ? "text-left" : justify === "right" ? "text-right" : "text-center"}>
|
return <div className={justify === "left" ? "text-left" : justify === "right" ? "text-right" : "text-center"}>
|
||||||
{onlyOne
|
{onlyOne
|
||||||
? <VariationLayer vs={[getShort(ps)[0]]} />
|
? <VariationLayer vs={[getLong(ps)[0]]} />
|
||||||
: "long" in ps ?
|
: "long" in ps ?
|
||||||
<div>
|
<div>
|
||||||
<VariationLayer vs={ps.long} />
|
<VariationLayer vs={ps.long} />
|
||||||
|
|
|
@ -9,12 +9,13 @@ import EPBlocksDisplay from "../RenderedBlocksDisplay";
|
||||||
import ModeSelect, { Mode, ScriptSelect } from "../DisplayModeSelect";
|
import ModeSelect, { Mode, ScriptSelect } from "../DisplayModeSelect";
|
||||||
import { useStickyState } from "../../library";
|
import { useStickyState } from "../../library";
|
||||||
|
|
||||||
function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne }: {
|
function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne, length }: {
|
||||||
eps: T.EPSelectionState,
|
eps: T.EPSelectionState,
|
||||||
opts: T.TextOptions,
|
opts: T.TextOptions,
|
||||||
setOmitSubject: ((value: "true" | "false") => void) | false
|
setOmitSubject: ((value: "true" | "false") => void) | false
|
||||||
justify?: "left" | "right" | "center",
|
justify?: "left" | "right" | "center",
|
||||||
onlyOne?: boolean | "concat",
|
onlyOne?: boolean | "concat",
|
||||||
|
length?: "long" | "short",
|
||||||
}) {
|
}) {
|
||||||
const [mode, setMode] = useState<Mode>("text");
|
const [mode, setMode] = useState<Mode>("text");
|
||||||
const [script, setScript] = useStickyState<"p" | "f">("f", "blockScriptChoice");
|
const [script, setScript] = useStickyState<"p" | "f">("f", "blockScriptChoice");
|
||||||
|
@ -54,7 +55,7 @@ function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne }: {
|
||||||
<div />
|
<div />
|
||||||
</div>
|
</div>
|
||||||
{mode === "text"
|
{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} />}
|
: <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"}`}>
|
{result.e && <div className={`text-muted mt-2 text-${justify === "left" ? "left" : justify === "right" ? "right" : "center"}`}>
|
||||||
{onlyOne === "concat"
|
{onlyOne === "concat"
|
||||||
|
|
Loading…
Reference in New Issue