Update to latest Action changes.

This commit is contained in:
Daniel J. Geiger 2023-01-07 15:47:19 -06:00
parent 45faf7d58f
commit ace031e992
6 changed files with 51 additions and 72 deletions

View file

@ -1301,7 +1301,7 @@ const createMathActions = () => {
const mathActions: Action[] = [];
const actionUseTexTrue: Action = {
name: "useTexTrue",
perform: (elements, appState, useTex: boolean | null) => {
perform: (elements, appState) => {
const mathOnly = getMathProps.getMathOnly(appState);
const customData = appState.customData ?? {};
customData[`${mathSubtype}`] = { useTex: true, mathOnly };
@ -1315,13 +1315,12 @@ const createMathActions = () => {
getMathProps.getUseTex(appState)
? "labels.useTexTrueActive"
: "labels.useTexTrueInactive",
shapeConfigPredicate: (elements, appState, data) =>
data?.source === mathSubtype,
predicate: (...rest) => rest.length < 5 || rest[4]?.source === mathSubtype,
trackEvent: false,
};
const actionUseTexFalse: Action = {
name: "useTexTrue",
perform: (elements, appState, useTex: boolean | null) => {
name: "useTexFalse",
perform: (elements, appState) => {
const mathOnly = getMathProps.getMathOnly(appState);
const customData = appState.customData ?? {};
customData[`${mathSubtype}`] = { useTex: false, mathOnly };
@ -1335,8 +1334,7 @@ const createMathActions = () => {
!getMathProps.getUseTex(appState)
? "labels.useTexFalseActive"
: "labels.useTexFalseInactive",
shapeConfigPredicate: (elements, appState, data) =>
data?.source === mathSubtype,
predicate: (...rest) => rest.length < 5 || rest[4]?.source === mathSubtype,
trackEvent: false,
};
const actionResetUseTex: Action = {
@ -1464,8 +1462,9 @@ const createMathActions = () => {
/>
</fieldset>
),
panelComponentPredicate: (elements, appState) =>
enableActionChangeMathProps(elements, appState),
predicate: (...rest) =>
rest[4]?.source === undefined &&
enableActionChangeMathProps(rest[0], rest[1]),
trackEvent: false,
};
const actionMath = SubtypeButton(mathSubtype, "text", mathSubtypeIcon, "M");