@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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Perseus editors",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "1.0.7",
6
+ "version": "1.0.9",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@khanacademy/kas": "^0.2.7",
25
25
  "@khanacademy/kmath": "^0.0.8",
26
- "@khanacademy/perseus": "^1.3.2"
26
+ "@khanacademy/perseus": "^1.3.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@khanacademy/wonder-blocks-button": "^2.11.5",
package/src/editor.jsx CHANGED
@@ -696,6 +696,7 @@ class Editor extends React.Component<EditorProps, EditorState> {
696
696
  _handleKeyDown: (e: SyntheticKeyboardEvent<HTMLTextAreaElement>) => void = (
697
697
  e: SyntheticKeyboardEvent<HTMLTextAreaElement>,
698
698
  ) => {
699
+ e.stopPropagation();
699
700
  // Tab-completion of widgets. For example, to insert an image:
700
701
  // type `[[im`, then tab.
701
702
  if (e.key === "Tab") {
@@ -75,7 +75,11 @@ class ChoiceEditor extends React.Component<$FlowFixMe> {
75
75
  <a
76
76
  className="simple-button orange delete-choice"
77
77
  href="#"
78
- onClick={this.props.onDelete}
78
+ onClick={(e) => {
79
+ e.stopPropagation();
80
+ e.preventDefault();
81
+ this.props.onDelete();
82
+ }}
79
83
  title="Remove this choice"
80
84
  >
81
85
  <InlineIcon {...iconTrash} />
@@ -185,7 +189,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
185
189
  editMode={true}
186
190
  labelWrap={false}
187
191
  apiOptions={this.props.apiOptions}
188
- choices={this.props.choices.map(function (choice, i) {
192
+ choices={this.props.choices.map((choice, i) => {
189
193
  return {
190
194
  content: (
191
195
  <ChoiceEditor
@@ -208,8 +212,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
208
212
  );
209
213
  }
210
214
  }}
211
- // eslint-disable-next-line react/jsx-no-bind
212
- onDelete={this.onDelete.bind(this, i)}
215
+ onDelete={() => this.onDelete(i)}
213
216
  showDelete={this.props.choices.length >= 2}
214
217
  />
215
218
  ),
@@ -322,9 +325,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
322
325
  this.props.onChange({choices: choices});
323
326
  };
324
327
 
325
- onDelete: (number, $FlowFixMe) => void = (choiceIndex, e) => {
326
- e.preventDefault();
327
-
328
+ onDelete: (number) => void = (choiceIndex) => {
328
329
  const choices = this.props.choices.slice();
329
330
  const deleted = choices[choiceIndex];
330
331