@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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @khanacademy/perseus-editor
2
2
 
3
+ ## 1.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c4feda94]
8
+ - Updated dependencies [6f79dc58]
9
+ - @khanacademy/perseus@1.3.5
10
+
11
+ ## 1.0.9
12
+
13
+ ### Patch Changes
14
+
15
+ - 5a565227: bugfix for Radio editor selection and deletion
16
+ - Updated dependencies [5a565227]
17
+ - @khanacademy/perseus@1.3.4
18
+
3
19
  ## 1.0.8
4
20
 
5
21
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -919,8 +919,9 @@ class Editor extends React.Component {
919
919
  });
920
920
 
921
921
  _defineProperty(this, "_handleKeyDown", e => {
922
- // Tab-completion of widgets. For example, to insert an image:
922
+ e.stopPropagation(); // Tab-completion of widgets. For example, to insert an image:
923
923
  // type `[[im`, then tab.
924
+
924
925
  if (e.key === "Tab") {
925
926
  // eslint-disable-next-line react/no-string-refs
926
927
  var textarea = ReactDOM.findDOMNode(this.refs.textarea); // findDOMNode can also return Text, but we know it's an element.
@@ -9070,9 +9071,15 @@ class InputNumberEditor extends React.Component {
9070
9071
  return true;
9071
9072
  });
9072
9073
 
9073
- _defineProperty(this, "serialize", () => {
9074
- return _.pick(this.props, "value", "simplify", "size", "inexact", "maxError", "answerType", "rightAlign");
9075
- });
9074
+ _defineProperty(this, "serialize", () => ({
9075
+ value: this.props.value,
9076
+ simplify: this.props.simplify,
9077
+ size: this.props.size,
9078
+ inexact: this.props.inexact,
9079
+ maxError: this.props.maxError,
9080
+ answerType: this.props.answerType,
9081
+ rightAlign: this.props.rightAlign
9082
+ }));
9076
9083
  }
9077
9084
 
9078
9085
  render() {
@@ -9159,16 +9166,6 @@ class InputNumberEditor extends React.Component {
9159
9166
 
9160
9167
  }
9161
9168
 
9162
- _defineProperty(InputNumberEditor, "propTypes", {
9163
- value: PropTypes.number,
9164
- simplify: PropTypes.oneOf(["required", "optional", "enforced"]),
9165
- size: PropTypes.oneOf(["normal", "small"]),
9166
- inexact: PropTypes.bool,
9167
- maxError: PropTypes.number,
9168
- answerType: PropTypes.string,
9169
- rightAlign: PropTypes.bool
9170
- });
9171
-
9172
9169
  _defineProperty(InputNumberEditor, "widgetName", "input-number");
9173
9170
 
9174
9171
  _defineProperty(InputNumberEditor, "defaultProps", {
@@ -14248,7 +14245,11 @@ class ChoiceEditor extends React.Component {
14248
14245
  var deleteLink = /*#__PURE__*/React.createElement("a", {
14249
14246
  className: "simple-button orange delete-choice",
14250
14247
  href: "#",
14251
- onClick: this.props.onDelete,
14248
+ onClick: e => {
14249
+ e.stopPropagation();
14250
+ e.preventDefault();
14251
+ this.props.onDelete();
14252
+ },
14252
14253
  title: "Remove this choice"
14253
14254
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconTrash$1));
14254
14255
  return /*#__PURE__*/React.createElement("div", {
@@ -14361,8 +14362,7 @@ class RadioEditor extends React.Component {
14361
14362
  });
14362
14363
  });
14363
14364
 
14364
- _defineProperty(this, "onDelete", (choiceIndex, e) => {
14365
- e.preventDefault();
14365
+ _defineProperty(this, "onDelete", choiceIndex => {
14366
14366
  var choices = this.props.choices.slice();
14367
14367
  var deleted = choices[choiceIndex];
14368
14368
  choices.splice(choiceIndex, 1);
@@ -14453,7 +14453,7 @@ class RadioEditor extends React.Component {
14453
14453
  editMode: true,
14454
14454
  labelWrap: false,
14455
14455
  apiOptions: this.props.apiOptions,
14456
- choices: this.props.choices.map(function (choice, i) {
14456
+ choices: this.props.choices.map((choice, i) => {
14457
14457
  return {
14458
14458
  content: /*#__PURE__*/React.createElement(ChoiceEditor, {
14459
14459
  ref: "choice-editor".concat(i),
@@ -14468,9 +14468,8 @@ class RadioEditor extends React.Component {
14468
14468
  if ("content" in newProps) {
14469
14469
  this.onClueChange(i, newProps.content);
14470
14470
  }
14471
- } // eslint-disable-next-line react/jsx-no-bind
14472
- ,
14473
- onDelete: this.onDelete.bind(this, i),
14471
+ },
14472
+ onDelete: () => this.onDelete(i),
14474
14473
  showDelete: this.props.choices.length >= 2
14475
14474
  }),
14476
14475
  isNoneOfTheAbove: choice.isNoneOfTheAbove,