@khanacademy/perseus-editor 1.0.8 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @khanacademy/perseus-editor
2
2
 
3
+ ## 1.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 5a565227: bugfix for Radio editor selection and deletion
8
+ - Updated dependencies [5a565227]
9
+ - @khanacademy/perseus@1.3.4
10
+
3
11
  ## 1.0.8
4
12
 
5
13
  ### 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.
@@ -14248,7 +14249,11 @@ class ChoiceEditor extends React.Component {
14248
14249
  var deleteLink = /*#__PURE__*/React.createElement("a", {
14249
14250
  className: "simple-button orange delete-choice",
14250
14251
  href: "#",
14251
- onClick: this.props.onDelete,
14252
+ onClick: e => {
14253
+ e.stopPropagation();
14254
+ e.preventDefault();
14255
+ this.props.onDelete();
14256
+ },
14252
14257
  title: "Remove this choice"
14253
14258
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconTrash$1));
14254
14259
  return /*#__PURE__*/React.createElement("div", {
@@ -14361,8 +14366,7 @@ class RadioEditor extends React.Component {
14361
14366
  });
14362
14367
  });
14363
14368
 
14364
- _defineProperty(this, "onDelete", (choiceIndex, e) => {
14365
- e.preventDefault();
14369
+ _defineProperty(this, "onDelete", choiceIndex => {
14366
14370
  var choices = this.props.choices.slice();
14367
14371
  var deleted = choices[choiceIndex];
14368
14372
  choices.splice(choiceIndex, 1);
@@ -14453,7 +14457,7 @@ class RadioEditor extends React.Component {
14453
14457
  editMode: true,
14454
14458
  labelWrap: false,
14455
14459
  apiOptions: this.props.apiOptions,
14456
- choices: this.props.choices.map(function (choice, i) {
14460
+ choices: this.props.choices.map((choice, i) => {
14457
14461
  return {
14458
14462
  content: /*#__PURE__*/React.createElement(ChoiceEditor, {
14459
14463
  ref: "choice-editor".concat(i),
@@ -14468,9 +14472,8 @@ class RadioEditor extends React.Component {
14468
14472
  if ("content" in newProps) {
14469
14473
  this.onClueChange(i, newProps.content);
14470
14474
  }
14471
- } // eslint-disable-next-line react/jsx-no-bind
14472
- ,
14473
- onDelete: this.onDelete.bind(this, i),
14475
+ },
14476
+ onDelete: () => this.onDelete(i),
14474
14477
  showDelete: this.props.choices.length >= 2
14475
14478
  }),
14476
14479
  isNoneOfTheAbove: choice.isNoneOfTheAbove,