@khanacademy/perseus-editor 1.0.7 → 1.0.9

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
@@ -893,8 +893,9 @@ class Editor extends React__namespace.Component {
893
893
  });
894
894
 
895
895
  _defineProperty(this, "_handleKeyDown", e => {
896
- // Tab-completion of widgets. For example, to insert an image:
896
+ e.stopPropagation(); // Tab-completion of widgets. For example, to insert an image:
897
897
  // type `[[im`, then tab.
898
+
898
899
  if (e.key === "Tab") {
899
900
  // eslint-disable-next-line react/no-string-refs
900
901
  const textarea = ReactDOM__namespace.findDOMNode(this.refs.textarea); // findDOMNode can also return Text, but we know it's an element.
@@ -14220,7 +14221,11 @@ class ChoiceEditor extends React__namespace.Component {
14220
14221
  const deleteLink = /*#__PURE__*/React__namespace.createElement("a", {
14221
14222
  className: "simple-button orange delete-choice",
14222
14223
  href: "#",
14223
- onClick: this.props.onDelete,
14224
+ onClick: e => {
14225
+ e.stopPropagation();
14226
+ e.preventDefault();
14227
+ this.props.onDelete();
14228
+ },
14224
14229
  title: "Remove this choice"
14225
14230
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconTrash$1));
14226
14231
  return /*#__PURE__*/React__namespace.createElement("div", {
@@ -14333,8 +14338,7 @@ class RadioEditor extends React__namespace.Component {
14333
14338
  });
14334
14339
  });
14335
14340
 
14336
- _defineProperty(this, "onDelete", (choiceIndex, e) => {
14337
- e.preventDefault();
14341
+ _defineProperty(this, "onDelete", choiceIndex => {
14338
14342
  const choices = this.props.choices.slice();
14339
14343
  const deleted = choices[choiceIndex];
14340
14344
  choices.splice(choiceIndex, 1);
@@ -14425,7 +14429,7 @@ class RadioEditor extends React__namespace.Component {
14425
14429
  editMode: true,
14426
14430
  labelWrap: false,
14427
14431
  apiOptions: this.props.apiOptions,
14428
- choices: this.props.choices.map(function (choice, i) {
14432
+ choices: this.props.choices.map((choice, i) => {
14429
14433
  return {
14430
14434
  content: /*#__PURE__*/React__namespace.createElement(ChoiceEditor, {
14431
14435
  ref: "choice-editor".concat(i),
@@ -14440,9 +14444,8 @@ class RadioEditor extends React__namespace.Component {
14440
14444
  if ("content" in newProps) {
14441
14445
  this.onClueChange(i, newProps.content);
14442
14446
  }
14443
- } // eslint-disable-next-line react/jsx-no-bind
14444
- ,
14445
- onDelete: this.onDelete.bind(this, i),
14447
+ },
14448
+ onDelete: () => this.onDelete(i),
14446
14449
  showDelete: this.props.choices.length >= 2
14447
14450
  }),
14448
14451
  isNoneOfTheAbove: choice.isNoneOfTheAbove,