Skip to content

Commit

Permalink
numCharacters property of text component
Browse files Browse the repository at this point in the history
  • Loading branch information
dqnykamp committed May 23, 2024
1 parent 654048b commit dfed03e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/doenetml-worker/src/components/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ export default class Text extends InlineComponent {
},
};

stateVariableDefinitions.numCharacters = {
public: true,
shadowingInstructions: {
createComponentOfType: "integer",
},
returnDependencies: () => ({
value: {
dependencyType: "stateVariable",
variableName: "value",
},
}),
definition({ dependencyValues }) {
return {
setValue: { numCharacters: dependencyValues.value.length },
};
},
};

stateVariableDefinitions.text = {
public: true,
shadowingInstructions: {
Expand Down

0 comments on commit dfed03e

Please sign in to comment.