@khanacademy/perseus-editor 1.0.8 → 1.0.10

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.
@@ -9036,9 +9037,15 @@ class InputNumberEditor extends React__namespace.Component {
9036
9037
  return true;
9037
9038
  });
9038
9039
 
9039
- _defineProperty(this, "serialize", () => {
9040
- return ___default["default"].pick(this.props, "value", "simplify", "size", "inexact", "maxError", "answerType", "rightAlign");
9041
- });
9040
+ _defineProperty(this, "serialize", () => ({
9041
+ value: this.props.value,
9042
+ simplify: this.props.simplify,
9043
+ size: this.props.size,
9044
+ inexact: this.props.inexact,
9045
+ maxError: this.props.maxError,
9046
+ answerType: this.props.answerType,
9047
+ rightAlign: this.props.rightAlign
9048
+ }));
9042
9049
  }
9043
9050
 
9044
9051
  render() {
@@ -9125,16 +9132,6 @@ class InputNumberEditor extends React__namespace.Component {
9125
9132
 
9126
9133
  }
9127
9134
 
9128
- _defineProperty(InputNumberEditor, "propTypes", {
9129
- value: PropTypes__default["default"].number,
9130
- simplify: PropTypes__default["default"].oneOf(["required", "optional", "enforced"]),
9131
- size: PropTypes__default["default"].oneOf(["normal", "small"]),
9132
- inexact: PropTypes__default["default"].bool,
9133
- maxError: PropTypes__default["default"].number,
9134
- answerType: PropTypes__default["default"].string,
9135
- rightAlign: PropTypes__default["default"].bool
9136
- });
9137
-
9138
9135
  _defineProperty(InputNumberEditor, "widgetName", "input-number");
9139
9136
 
9140
9137
  _defineProperty(InputNumberEditor, "defaultProps", {
@@ -14220,7 +14217,11 @@ class ChoiceEditor extends React__namespace.Component {
14220
14217
  const deleteLink = /*#__PURE__*/React__namespace.createElement("a", {
14221
14218
  className: "simple-button orange delete-choice",
14222
14219
  href: "#",
14223
- onClick: this.props.onDelete,
14220
+ onClick: e => {
14221
+ e.stopPropagation();
14222
+ e.preventDefault();
14223
+ this.props.onDelete();
14224
+ },
14224
14225
  title: "Remove this choice"
14225
14226
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconTrash$1));
14226
14227
  return /*#__PURE__*/React__namespace.createElement("div", {
@@ -14333,8 +14334,7 @@ class RadioEditor extends React__namespace.Component {
14333
14334
  });
14334
14335
  });
14335
14336
 
14336
- _defineProperty(this, "onDelete", (choiceIndex, e) => {
14337
- e.preventDefault();
14337
+ _defineProperty(this, "onDelete", choiceIndex => {
14338
14338
  const choices = this.props.choices.slice();
14339
14339
  const deleted = choices[choiceIndex];
14340
14340
  choices.splice(choiceIndex, 1);
@@ -14425,7 +14425,7 @@ class RadioEditor extends React__namespace.Component {
14425
14425
  editMode: true,
14426
14426
  labelWrap: false,
14427
14427
  apiOptions: this.props.apiOptions,
14428
- choices: this.props.choices.map(function (choice, i) {
14428
+ choices: this.props.choices.map((choice, i) => {
14429
14429
  return {
14430
14430
  content: /*#__PURE__*/React__namespace.createElement(ChoiceEditor, {
14431
14431
  ref: "choice-editor".concat(i),
@@ -14440,9 +14440,8 @@ class RadioEditor extends React__namespace.Component {
14440
14440
  if ("content" in newProps) {
14441
14441
  this.onClueChange(i, newProps.content);
14442
14442
  }
14443
- } // eslint-disable-next-line react/jsx-no-bind
14444
- ,
14445
- onDelete: this.onDelete.bind(this, i),
14443
+ },
14444
+ onDelete: () => this.onDelete(i),
14446
14445
  showDelete: this.props.choices.length >= 2
14447
14446
  }),
14448
14447
  isNoneOfTheAbove: choice.isNoneOfTheAbove,