@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/es/index.js CHANGED
@@ -45,7 +45,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
45
45
 
46
46
  // This file is processed by a Rollup plugin (replace) to inject the production
47
47
  const libName = "@khanacademy/perseus-editor";
48
- const libVersion = "17.0.10";
48
+ const libVersion = "17.0.11";
49
49
  addLibraryVersionToPerseusDebug(libName, libVersion);
50
50
 
51
51
  function _extends() {
@@ -25284,12 +25284,13 @@ class ExpressionEditor extends React.Component {
25284
25284
  return issues;
25285
25285
  };
25286
25286
  this._newEmptyAnswerForm = () => {
25287
+ const newKey = _makeNewKey(this.props.answerForms);
25287
25288
  return {
25288
25289
  considered: "correct",
25289
25290
  form: false,
25290
25291
  // note: the key means "n-th form created" - not "form in
25291
25292
  // position n" and will stay the same for the life of this form
25292
- key: _makeNewKey(this.props.answerForms),
25293
+ key: `${newKey}`,
25293
25294
  simplify: false,
25294
25295
  value: ""
25295
25296
  };
@@ -25304,8 +25305,11 @@ class ExpressionEditor extends React.Component {
25304
25305
  this.handleRemoveForm = i => {
25305
25306
  const answerForms = this.props.answerForms.slice();
25306
25307
  answerForms.splice(i, 1);
25308
+ const updatedAnswerForms = answerForms.map((form, index) => _extends({}, form, {
25309
+ key: `${index}`
25310
+ }));
25307
25311
  this.change({
25308
- answerForms
25312
+ answerForms: updatedAnswerForms
25309
25313
  });
25310
25314
  };
25311
25315
  this.handleReorder = components => {
@@ -25411,7 +25415,7 @@ class ExpressionEditor extends React.Component {
25411
25415
  });
25412
25416
  }
25413
25417
  render() {
25414
- const answerOptions = this.props.answerForms.map(ans => {
25418
+ const answerOptions = this.props.answerForms.map((ans, index) => {
25415
25419
  const key = parseAnswerKey(ans);
25416
25420
  const expressionProps = {
25417
25421
  // note we're using
@@ -25436,7 +25440,7 @@ class ExpressionEditor extends React.Component {
25436
25440
  expressionProps: expressionProps,
25437
25441
  form: ans.form,
25438
25442
  simplify: ans.simplify,
25439
- onDelete: () => this.handleRemoveForm(key),
25443
+ onDelete: () => this.handleRemoveForm(index),
25440
25444
  onChangeSimplify: simplify => this.changeSimplify(key, simplify),
25441
25445
  onChangeForm: form => this.changeForm(key, form),
25442
25446
  onChangeConsidered: considered => this.changeConsidered(key, considered)
@@ -25534,6 +25538,7 @@ class AnswerOption extends React.Component {
25534
25538
  };
25535
25539
  this.handleImSure = () => {
25536
25540
  this.props.onDelete();
25541
+ this.handleCancelDelete();
25537
25542
  };
25538
25543
  this.handleCancelDelete = () => {
25539
25544
  this.setState({