@khanacademy/perseus-editor 17.0.10 → 17.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -96,7 +96,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
96
96
 
97
97
  // This file is processed by a Rollup plugin (replace) to inject the production
98
98
  const libName = "@khanacademy/perseus-editor";
99
- const libVersion = "17.0.10";
99
+ const libVersion = "17.0.11";
100
100
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
101
101
 
102
102
  function _extends() {
@@ -25323,12 +25323,13 @@ class ExpressionEditor extends React__namespace.Component {
25323
25323
  return issues;
25324
25324
  };
25325
25325
  _newEmptyAnswerForm = () => {
25326
+ const newKey = _makeNewKey(this.props.answerForms);
25326
25327
  return {
25327
25328
  considered: "correct",
25328
25329
  form: false,
25329
25330
  // note: the key means "n-th form created" - not "form in
25330
25331
  // position n" and will stay the same for the life of this form
25331
- key: _makeNewKey(this.props.answerForms),
25332
+ key: `${newKey}`,
25332
25333
  simplify: false,
25333
25334
  value: ""
25334
25335
  };
@@ -25343,8 +25344,12 @@ class ExpressionEditor extends React__namespace.Component {
25343
25344
  handleRemoveForm = i => {
25344
25345
  const answerForms = this.props.answerForms.slice();
25345
25346
  answerForms.splice(i, 1);
25347
+ const updatedAnswerForms = answerForms.map((form, index) => ({
25348
+ ...form,
25349
+ key: `${index}`
25350
+ }));
25346
25351
  this.change({
25347
- answerForms
25352
+ answerForms: updatedAnswerForms
25348
25353
  });
25349
25354
  };
25350
25355
 
@@ -25454,7 +25459,7 @@ class ExpressionEditor extends React__namespace.Component {
25454
25459
  this.updateAnswerForm(key, answerForm);
25455
25460
  };
25456
25461
  render() {
25457
- const answerOptions = this.props.answerForms.map(ans => {
25462
+ const answerOptions = this.props.answerForms.map((ans, index) => {
25458
25463
  const key = parseAnswerKey(ans);
25459
25464
  const expressionProps = {
25460
25465
  // note we're using
@@ -25479,7 +25484,7 @@ class ExpressionEditor extends React__namespace.Component {
25479
25484
  expressionProps: expressionProps,
25480
25485
  form: ans.form,
25481
25486
  simplify: ans.simplify,
25482
- onDelete: () => this.handleRemoveForm(key),
25487
+ onDelete: () => this.handleRemoveForm(index),
25483
25488
  onChangeSimplify: simplify => this.changeSimplify(key, simplify),
25484
25489
  onChangeForm: form => this.changeForm(key, form),
25485
25490
  onChangeConsidered: considered => this.changeConsidered(key, considered)
@@ -25574,6 +25579,7 @@ class AnswerOption extends React__namespace.Component {
25574
25579
  })();
25575
25580
  handleImSure = () => {
25576
25581
  this.props.onDelete();
25582
+ this.handleCancelDelete();
25577
25583
  };
25578
25584
  handleCancelDelete = () => {
25579
25585
  this.setState({