@khanacademy/perseus-editor 2.6.0 → 2.6.2

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.
Files changed (180) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/article-editor.d.ts +1 -2
  3. package/dist/components/form-wrapped-text-field.d.ts +1 -10
  4. package/dist/components/graph-points-count-selector.d.ts +1 -1
  5. package/dist/es/index.js +414 -436
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.js +411 -435
  8. package/dist/index.js.map +1 -1
  9. package/dist/widgets/input-number-editor.d.ts +1 -2
  10. package/dist/widgets/interactive-graph-editor.d.ts +48 -47
  11. package/dist/widgets/plotter-editor.d.ts +47 -23
  12. package/package.json +12 -12
  13. package/src/__stories__/editor.stories.tsx +3 -1
  14. package/src/__tests__/i18n.test.ts +1 -1
  15. package/src/article-editor.tsx +13 -14
  16. package/src/components/checkbox.tsx +2 -1
  17. package/src/components/dropdown-option.tsx +13 -12
  18. package/src/components/form-wrapped-text-field.tsx +5 -2
  19. package/src/components/graph-points-count-selector.tsx +3 -1
  20. package/src/components/graph-settings.tsx +1 -1
  21. package/src/components/hover-behavior.ts +2 -2
  22. package/src/components/json-editor.tsx +2 -2
  23. package/src/components/sortable.tsx +1 -1
  24. package/src/components/util.ts +1 -1
  25. package/src/components/widget-editor.tsx +8 -7
  26. package/src/diffs/__tests__/structured-item-diff.test.ts +8 -8
  27. package/src/diffs/renderer-diff.tsx +3 -3
  28. package/src/diffs/split-diff.ts +2 -2
  29. package/src/diffs/structured-item-diff.tsx +11 -10
  30. package/src/diffs/text-diff.tsx +1 -1
  31. package/src/diffs/widget-diff.tsx +2 -2
  32. package/src/editor-page.tsx +8 -8
  33. package/src/editor.tsx +37 -36
  34. package/src/hint-editor.tsx +28 -27
  35. package/src/i18n.ts +4 -4
  36. package/src/iframe-content-renderer.tsx +10 -10
  37. package/src/item-editor.tsx +4 -4
  38. package/src/katex-mhchem/parser.js +24 -24
  39. package/src/multirenderer-editor.tsx +11 -11
  40. package/src/widgets/__stories__/label-image-editor.stories.tsx +1 -0
  41. package/src/widgets/__stories__/radio-editor.stories.tsx +1 -0
  42. package/src/widgets/categorizer-editor.tsx +3 -3
  43. package/src/widgets/cs-program-editor.tsx +2 -2
  44. package/src/widgets/definition-editor.tsx +3 -2
  45. package/src/widgets/dropdown-editor.tsx +9 -8
  46. package/src/widgets/example-graphie-widget-editor.tsx +1 -1
  47. package/src/widgets/example-graphie-widget.tsx +2 -2
  48. package/src/widgets/example-widget-editor.tsx +2 -2
  49. package/src/widgets/example-widget.tsx +4 -3
  50. package/src/widgets/explanation-editor.tsx +4 -3
  51. package/src/widgets/expression-editor.tsx +9 -9
  52. package/src/widgets/graded-group-editor.tsx +7 -6
  53. package/src/widgets/graded-group-set-editor.tsx +3 -3
  54. package/src/widgets/grapher-editor.tsx +3 -2
  55. package/src/widgets/group-editor.tsx +4 -3
  56. package/src/widgets/iframe-editor.tsx +5 -4
  57. package/src/widgets/input-number-editor.tsx +6 -6
  58. package/src/widgets/interaction-editor.tsx +103 -102
  59. package/src/widgets/interactive-graph-editor.tsx +12 -8
  60. package/src/widgets/label-image/marker.tsx +2 -1
  61. package/src/widgets/label-image/question-markers.tsx +1 -1
  62. package/src/widgets/lights-puzzle-editor.tsx +5 -4
  63. package/src/widgets/matrix-editor.tsx +2 -2
  64. package/src/widgets/measurer-editor.tsx +7 -6
  65. package/src/widgets/molecule-editor.tsx +2 -2
  66. package/src/widgets/number-line-editor.tsx +2 -1
  67. package/src/widgets/numeric-input-editor.tsx +2 -2
  68. package/src/widgets/orderer-editor.tsx +3 -2
  69. package/src/widgets/passage-editor.tsx +3 -3
  70. package/src/widgets/passage-ref-editor.tsx +4 -3
  71. package/src/widgets/passage-ref-target-editor.tsx +1 -1
  72. package/src/widgets/plotter-editor.tsx +253 -243
  73. package/src/widgets/radio/editor.tsx +3 -3
  74. package/src/widgets/reaction-diagram-editor.tsx +5 -5
  75. package/src/widgets/sequence-editor.tsx +1 -1
  76. package/src/widgets/simple-markdown-tester-editor.tsx +4 -3
  77. package/src/widgets/simple-markdown-tester.tsx +2 -2
  78. package/src/widgets/simulator-editor.tsx +1 -1
  79. package/src/widgets/sorter-editor.tsx +2 -1
  80. package/src/widgets/table-editor.tsx +1 -1
  81. package/src/widgets/transformer-editor.tsx +10 -10
  82. package/src/widgets/unit-editor.tsx +5 -5
  83. package/tsconfig-build.tsbuildinfo +1 -1
  84. package/dist/all-editors.js.flow +0 -8
  85. package/dist/all-widgets.js.flow +0 -34
  86. package/dist/article-editor.js.flow +0 -72
  87. package/dist/components/blur-input.js.flow +0 -25
  88. package/dist/components/checkbox.js.flow +0 -26
  89. package/dist/components/device-framer.js.flow +0 -20
  90. package/dist/components/drag-target.js.flow +0 -8
  91. package/dist/components/dropdown-option.js.flow +0 -49
  92. package/dist/components/form-wrapped-text-field.js.flow +0 -45
  93. package/dist/components/graph-points-count-selector.js.flow +0 -12
  94. package/dist/components/graph-settings.js.flow +0 -8
  95. package/dist/components/graph-type-selector.js.flow +0 -12
  96. package/dist/components/hover-behavior.js.flow +0 -48
  97. package/dist/components/json-editor.js.flow +0 -8
  98. package/dist/components/link.js.flow +0 -50
  99. package/dist/components/section-control-button.js.flow +0 -25
  100. package/dist/components/segment-count-selector.js.flow +0 -11
  101. package/dist/components/simple-button.js.flow +0 -18
  102. package/dist/components/sortable.js.flow +0 -8
  103. package/dist/components/util.js.flow +0 -9
  104. package/dist/components/viewport-resizer.js.flow +0 -22
  105. package/dist/components/widget-editor.js.flow +0 -91
  106. package/dist/components/widget-select.js.flow +0 -16
  107. package/dist/diffs/article-diff.js.flow +0 -71
  108. package/dist/diffs/item-diff.js.flow +0 -41
  109. package/dist/diffs/renderer-diff.js.flow +0 -25
  110. package/dist/diffs/split-diff.js.flow +0 -8
  111. package/dist/diffs/string-array-diff.js.flow +0 -11
  112. package/dist/diffs/structured-item-diff.js.flow +0 -37
  113. package/dist/diffs/tags-diff.js.flow +0 -24
  114. package/dist/diffs/text-diff.js.flow +0 -21
  115. package/dist/diffs/widget-diff-performer.js.flow +0 -8
  116. package/dist/diffs/widget-diff.js.flow +0 -31
  117. package/dist/editor-page.js.flow +0 -72
  118. package/dist/editor.js.flow +0 -96
  119. package/dist/hint-editor.js.flow +0 -87
  120. package/dist/i18n.js.flow +0 -13
  121. package/dist/iframe-content-renderer.js.flow +0 -28
  122. package/dist/index.js.flow +0 -23
  123. package/dist/item-editor.js.flow +0 -46
  124. package/dist/item-extras-editor.js.flow +0 -23
  125. package/dist/katex-error-view.js.flow +0 -24
  126. package/dist/multirenderer-editor.js.flow +0 -46
  127. package/dist/stateful-article-editor.js.flow +0 -16
  128. package/dist/stateful-editor-page.js.flow +0 -8
  129. package/dist/testing-widgets.js.flow +0 -34
  130. package/dist/util/points.js.flow +0 -9
  131. package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +0 -7
  132. package/dist/widgets/categorizer-editor.js.flow +0 -62
  133. package/dist/widgets/cs-program-editor.js.flow +0 -25
  134. package/dist/widgets/definition-editor.js.flow +0 -23
  135. package/dist/widgets/dropdown-editor.js.flow +0 -37
  136. package/dist/widgets/example-graphie-widget-editor.js.flow +0 -25
  137. package/dist/widgets/example-graphie-widget.js.flow +0 -102
  138. package/dist/widgets/example-widget-editor.js.flow +0 -26
  139. package/dist/widgets/example-widget.js.flow +0 -86
  140. package/dist/widgets/explanation-editor.js.flow +0 -27
  141. package/dist/widgets/expression-editor.js.flow +0 -43
  142. package/dist/widgets/graded-group-editor.js.flow +0 -68
  143. package/dist/widgets/graded-group-set-editor.js.flow +0 -66
  144. package/dist/widgets/grapher-editor.js.flow +0 -21
  145. package/dist/widgets/group-editor.js.flow +0 -64
  146. package/dist/widgets/iframe-editor.js.flow +0 -24
  147. package/dist/widgets/image-editor.js.flow +0 -8
  148. package/dist/widgets/input-number-editor.js.flow +0 -77
  149. package/dist/widgets/interaction/constraint-editor.js.flow +0 -35
  150. package/dist/widgets/interaction-editor.js.flow +0 -36
  151. package/dist/widgets/interactive-graph-editor.js.flow +0 -5803
  152. package/dist/widgets/label-image/answer-choices.js.flow +0 -16
  153. package/dist/widgets/label-image/behavior.js.flow +0 -17
  154. package/dist/widgets/label-image/marker.js.flow +0 -32
  155. package/dist/widgets/label-image/question-markers.js.flow +0 -23
  156. package/dist/widgets/label-image/select-image.js.flow +0 -13
  157. package/dist/widgets/label-image-editor.js.flow +0 -44
  158. package/dist/widgets/lights-puzzle-editor.js.flow +0 -34
  159. package/dist/widgets/matcher-editor.js.flow +0 -28
  160. package/dist/widgets/matrix-editor.js.flow +0 -26
  161. package/dist/widgets/measurer-editor.js.flow +0 -42
  162. package/dist/widgets/molecule-editor.js.flow +0 -23
  163. package/dist/widgets/number-line-editor.js.flow +0 -45
  164. package/dist/widgets/numeric-input-editor.js.flow +0 -8
  165. package/dist/widgets/orderer-editor.js.flow +0 -30
  166. package/dist/widgets/passage-editor.js.flow +0 -24
  167. package/dist/widgets/passage-ref-editor.js.flow +0 -17
  168. package/dist/widgets/passage-ref-target-editor.js.flow +0 -22
  169. package/dist/widgets/plotter-editor.js.flow +0 -53
  170. package/dist/widgets/radio/editor.js.flow +0 -81
  171. package/dist/widgets/reaction-diagram-editor.js.flow +0 -26
  172. package/dist/widgets/sequence-editor.js.flow +0 -73
  173. package/dist/widgets/simple-markdown-tester-editor.js.flow +0 -23
  174. package/dist/widgets/simple-markdown-tester.js.flow +0 -61
  175. package/dist/widgets/simulator-editor.js.flow +0 -26
  176. package/dist/widgets/sorter-editor.js.flow +0 -22
  177. package/dist/widgets/table-editor.js.flow +0 -24
  178. package/dist/widgets/transformer-editor.js.flow +0 -17
  179. package/dist/widgets/unit-editor.js.flow +0 -41
  180. package/dist/widgets/video-editor.js.flow +0 -25
@@ -69,7 +69,7 @@ type State = {
69
69
 
70
70
  class EditorPage extends React.Component<Props, State> {
71
71
  _isMounted: boolean;
72
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'rendererMountNode' has no initializer and is not definitely assigned in the constructor.
72
+ // @ts-expect-error - TS2564 - Property 'rendererMountNode' has no initializer and is not definitely assigned in the constructor.
73
73
  rendererMountNode: HTMLDivElement;
74
74
  renderer: RendererInterface | null | undefined;
75
75
 
@@ -87,7 +87,7 @@ class EditorPage extends React.Component<Props, State> {
87
87
  super(props);
88
88
 
89
89
  this.state = {
90
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "hints" | "question" | "answerArea" | "itemDataVersion">' is not assignable to type 'PerseusJson'.
90
+ // @ts-expect-error - TS2322 - Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "hints" | "question" | "answerArea" | "itemDataVersion">' is not assignable to type 'PerseusJson'.
91
91
  json: _.pick(
92
92
  this.props,
93
93
  "question",
@@ -161,7 +161,7 @@ class EditorPage extends React.Component<Props, State> {
161
161
  };
162
162
 
163
163
  // eslint-disable-next-line react/no-string-refs
164
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'triggerPreviewUpdate' does not exist on type 'ReactInstance'.
164
+ // @ts-expect-error - TS2339 - Property 'triggerPreviewUpdate' does not exist on type 'ReactInstance'.
165
165
  this.refs.itemEditor.triggerPreviewUpdate({
166
166
  type: "question",
167
167
  data: _({
@@ -177,7 +177,7 @@ class EditorPage extends React.Component<Props, State> {
177
177
  },
178
178
  reviewMode: true,
179
179
  // eslint-disable-next-line react/no-string-refs
180
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
180
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
181
181
  legacyPerseusLint: this.refs.itemEditor.getSaveWarnings(),
182
182
  }).extend(
183
183
  _(this.props).pick(
@@ -199,10 +199,10 @@ class EditorPage extends React.Component<Props, State> {
199
199
 
200
200
  getSaveWarnings(): any {
201
201
  // eslint-disable-next-line react/no-string-refs
202
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
202
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
203
203
  const issues1 = this.refs.itemEditor.getSaveWarnings();
204
204
  // eslint-disable-next-line react/no-string-refs
205
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
205
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
206
206
  const issues2 = this.refs.hintsEditor.getSaveWarnings();
207
207
  return issues1.concat(issues2);
208
208
  }
@@ -212,10 +212,10 @@ class EditorPage extends React.Component<Props, State> {
212
212
  return this.state.json;
213
213
  }
214
214
  // eslint-disable-next-line react/no-string-refs
215
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
215
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
216
216
  return _.extend(this.refs.itemEditor.serialize(options), {
217
217
  // eslint-disable-next-line react/no-string-refs
218
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
218
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
219
219
  hints: this.refs.hintsEditor.serialize(options),
220
220
  });
221
221
  }
package/src/editor.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  import {
2
3
  preprocessTex,
3
4
  Errors,
@@ -87,7 +88,7 @@ const IMAGE_REGEX = /!\[[^\]]*\]\(([^\s)]+)[^)]*\)/g;
87
88
  * ignores captures. If you don't need captures, use String::match
88
89
  */
89
90
  const allMatches = function (regex: RegExp, str: string) {
90
- // @ts-expect-error [FEI-5003] - TS2702 - 'RegExp' only refers to a type, but is being used as a namespace here.
91
+ // @ts-expect-error - TS2702 - 'RegExp' only refers to a type, but is being used as a namespace here.
91
92
  const result: Array<any | RegExp.matchResult> = [];
92
93
  // eslint-disable-next-line no-constant-condition
93
94
  while (true) {
@@ -183,9 +184,9 @@ class Editor extends React.Component<Props, State> {
183
184
  // setState
184
185
  this._sizeImages(this.props);
185
186
  // eslint-disable-next-line react/no-string-refs
186
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
187
+ // @ts-expect-error - TS2769 - No overload matches this call.
187
188
  $(ReactDOM.findDOMNode(this.refs.textarea))
188
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'on' does not exist on type 'JQueryStatic'.
189
+ // @ts-expect-error - TS2339 - Property 'on' does not exist on type 'JQueryStatic'.
189
190
  .on("copy cut", this._maybeCopyWidgets)
190
191
  .on("paste", this._maybePasteWidgets);
191
192
  }
@@ -215,13 +216,13 @@ class Editor extends React.Component<Props, State> {
215
216
  * textarea should be refined with an instanceof check to
216
217
  * HTMLTextAreaElement so that these props are available.
217
218
  */
218
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
219
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
219
220
  textarea.focus();
220
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'value' does not exist on type 'Element | Text'.
221
+ // @ts-expect-error - TS2339 - Property 'value' does not exist on type 'Element | Text'.
221
222
  textarea.value = this.lastUserValue;
222
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'selectionStart' does not exist on type 'Element | Text'.
223
+ // @ts-expect-error - TS2339 - Property 'selectionStart' does not exist on type 'Element | Text'.
223
224
  textarea.selectionStart = 0;
224
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'select' does not exist on type 'Element | Text'.
225
+ // @ts-expect-error - TS2339 - Property 'select' does not exist on type 'Element | Text'.
225
226
  textarea.select(0, prevProps.content.length);
226
227
  if (
227
228
  document.execCommand(
@@ -232,7 +233,7 @@ class Editor extends React.Component<Props, State> {
232
233
  ) {
233
234
  // This command is not implemented. Fall back to setting `value`
234
235
  // directly.
235
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'value' does not exist on type 'Element | Text'.
236
+ // @ts-expect-error - TS2339 - Property 'value' does not exist on type 'Element | Text'.
236
237
  textarea.value = this.props.content;
237
238
  }
238
239
  this.lastUserValue = null;
@@ -258,11 +259,11 @@ class Editor extends React.Component<Props, State> {
258
259
  }
259
260
  return (
260
261
  <WidgetEditor
261
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'number | undefined'.
262
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'number | undefined'.
262
263
  key={id}
263
264
  ref={id}
264
265
  id={id}
265
- // @ts-expect-error [FEI-5003] - TS2783 - 'type' is specified more than once, so this usage will be overwritten.
266
+ // @ts-expect-error - TS2783 - 'type' is specified more than once, so this usage will be overwritten.
266
267
  type={type}
267
268
  // eslint-disable-next-line react/jsx-no-bind
268
269
  onChange={this._handleWidgetEditorChange.bind(this, id)}
@@ -294,7 +295,7 @@ class Editor extends React.Component<Props, State> {
294
295
  // eslint-disable-next-line react/no-string-refs
295
296
  const textarea = this.refs.textarea;
296
297
  const re = new RegExp(widgetRegExp.replace("{id}", id), "gm");
297
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'value' does not exist on type 'ReactInstance'.
298
+ // @ts-expect-error - TS2339 - Property 'value' does not exist on type 'ReactInstance'.
298
299
  this.props.onChange({content: textarea.value.replace(re, "")});
299
300
  };
300
301
 
@@ -334,7 +335,7 @@ class Editor extends React.Component<Props, State> {
334
335
  {
335
336
  images: _.clone(images),
336
337
  },
337
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'null' is not assignable to parameter of type '(() => unknown) | undefined'.
338
+ // @ts-expect-error - TS2345 - Argument of type 'null' is not assignable to parameter of type '(() => unknown) | undefined'.
338
339
  null, // callback
339
340
  true, // silent
340
341
  );
@@ -410,13 +411,13 @@ class Editor extends React.Component<Props, State> {
410
411
  this.props.onChange({content: content});
411
412
  })
412
413
  .each((fileAndSentinel) => {
413
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2345 - Argument of type 'File' is not assignable to parameter of type 'string'.
414
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2345 - Argument of type 'File' is not assignable to parameter of type 'string'.
414
415
  imageUploader(fileAndSentinel.file, (url) => {
415
416
  // See componentDidUpdate() for how this flag is used
416
417
  this.lastUserValue = origContent;
417
418
  this.props.onChange({
418
419
  content: this.state.textAreaValue.replace(
419
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
420
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
420
421
  fileAndSentinel.sentinel,
421
422
  url,
422
423
  ),
@@ -452,7 +453,7 @@ class Editor extends React.Component<Props, State> {
452
453
  const textarea = ReactDOM.findDOMNode(this.refs.textarea);
453
454
 
454
455
  // findDOMNode can also return Text, but we know it's an element.
455
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
456
+ // @ts-expect-error - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
456
457
  const word = Util.textarea.getWordBeforeCursor(textarea);
457
458
  const matches = word.string.toLowerCase().match(shortcutRegexp);
458
459
 
@@ -492,10 +493,10 @@ class Editor extends React.Component<Props, State> {
492
493
  );
493
494
 
494
495
  const widgetNames = _.map(
495
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'RegExpMatchArray | null' is not assignable to parameter of type 'Collection<any>'.
496
+ // @ts-expect-error - TS2345 - Argument of type 'RegExpMatchArray | null' is not assignable to parameter of type 'Collection<any>'.
496
497
  selectedText.match(rWidgetSplit),
497
498
  (syntax) => {
498
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
499
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
499
500
  return Util.rWidgetParts.exec(syntax)[1];
500
501
  },
501
502
  );
@@ -519,7 +520,7 @@ class Editor extends React.Component<Props, State> {
519
520
  const widgetJSON = localStorage.perseusLastCopiedWidgets;
520
521
  const lastCopiedText = localStorage.perseusLastCopiedText;
521
522
  const textToBePasted =
522
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'originalEvent' does not exist on type 'SyntheticEvent<HTMLTextAreaElement, Event>'.
523
+ // @ts-expect-error - TS2339 - Property 'originalEvent' does not exist on type 'SyntheticEvent<HTMLTextAreaElement, Event>'.
523
524
  e.originalEvent.clipboardData.getData("text");
524
525
 
525
526
  // Only intercept if we have widget data to paste and the user is
@@ -550,9 +551,9 @@ class Editor extends React.Component<Props, State> {
550
551
  rWidgetSplit,
551
552
  (syntax) => {
552
553
  const match = Util.rWidgetParts.exec(syntax);
553
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
554
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
554
555
  const completeWidget = match[0];
555
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
556
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
556
557
  const widget = match[1];
557
558
  return completeWidget.replace(
558
559
  widget,
@@ -649,12 +650,12 @@ class Editor extends React.Component<Props, State> {
649
650
  // Note: we have to use _.map here instead of Array::map
650
651
  // because the results of a .match might be null if no
651
652
  // widgets were found.
652
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'RegExpMatchArray | null' is not assignable to parameter of type 'Collection<any>'.
653
+ // @ts-expect-error - TS2345 - Argument of type 'RegExpMatchArray | null' is not assignable to parameter of type 'Collection<any>'.
653
654
  const allWidgetIds = _.map(oldContent.match(rWidgetSplit), (syntax) => {
654
655
  const match = Util.rWidgetParts.exec(syntax);
655
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
656
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
656
657
  const type = match[2];
657
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
658
+ // @ts-expect-error - TS2531 - Object is possibly 'null'.
658
659
  const num = +match[3];
659
660
  return [type, num];
660
661
  });
@@ -692,12 +693,12 @@ class Editor extends React.Component<Props, State> {
692
693
  const newWidgets = _.clone(this.props.widgets);
693
694
  newWidgets[id] = {
694
695
  options: Widgets.getEditor(widgetType)?.defaultProps,
695
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type '"video" | "image" | "iframe" | "table" | "radio" | "definition" | "group" | "matrix" | "categorizer" | "cs-program" | "dropdown" | "example-graphie-widget" | "example-widget" | ... 26 more ... | "unit-input"'.
696
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"video" | "image" | "iframe" | "table" | "radio" | "definition" | "group" | "matrix" | "categorizer" | "cs-program" | "dropdown" | "example-graphie-widget" | "example-widget" | ... 26 more ... | "unit-input"'.
696
697
  type: widgetType,
697
698
  // Track widget version on creation, so that a widget editor
698
699
  // without a valid version prop can only possibly refer to a
699
700
  // pre-versioning creation time.
700
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Version | null | undefined' is not assignable to type 'Version | undefined'.
701
+ // @ts-expect-error - TS2322 - Type 'Version | null | undefined' is not assignable to type 'Version | undefined'.
701
702
  version: Widgets.getVersion(widgetType),
702
703
  };
703
704
 
@@ -711,7 +712,7 @@ class Editor extends React.Component<Props, State> {
711
712
  function () {
712
713
  Util.textarea.moveCursor(
713
714
  // findDOMNode can return Text but we know this is Element
714
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
715
+ // @ts-expect-error - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
715
716
  textarea,
716
717
  // We want to put the cursor after the widget
717
718
  // and after any added newlines
@@ -727,11 +728,11 @@ class Editor extends React.Component<Props, State> {
727
728
 
728
729
  this._addWidgetToContent(
729
730
  this.props.content,
730
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'selectionStart' does not exist on type 'ReactInstance'. | TS2339 - Property 'selectionEnd' does not exist on type 'ReactInstance'.
731
+ // @ts-expect-error - TS2339 - Property 'selectionStart' does not exist on type 'ReactInstance'. | TS2339 - Property 'selectionEnd' does not exist on type 'ReactInstance'.
731
732
  [textarea.selectionStart, textarea.selectionEnd],
732
733
  widgetType,
733
734
  );
734
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
735
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
735
736
  textarea.focus();
736
737
  };
737
738
 
@@ -806,7 +807,7 @@ class Editor extends React.Component<Props, State> {
806
807
  .chain()
807
808
  .map((id) => {
808
809
  // eslint-disable-next-line react/no-string-refs
809
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
810
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
810
811
  const issuesFunc = this.refs[id].getSaveWarnings;
811
812
  const issues = issuesFunc ? issuesFunc() : [];
812
813
  return _.map(issues, (issue) => id + ": " + issue);
@@ -826,7 +827,7 @@ class Editor extends React.Component<Props, State> {
826
827
  * textarea should be refined with an instanceof check to
827
828
  * HTMLTextAreaElement so that these props are available.
828
829
  */
829
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
830
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
830
831
  textarea.focus();
831
832
  }
832
833
  };
@@ -841,9 +842,9 @@ class Editor extends React.Component<Props, State> {
841
842
  * textarea should be refined with an instanceof check to
842
843
  * HTMLTextAreaElement so that these props are available.
843
844
  */
844
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'selectionStart' does not exist on type 'Element | Text'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
845
+ // @ts-expect-error - TS2339 - Property 'selectionStart' does not exist on type 'Element | Text'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
845
846
  textarea.selectionStart = textarea.value.length;
846
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'selectionEnd' does not exist on type 'Element | Text'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
847
+ // @ts-expect-error - TS2339 - Property 'selectionEnd' does not exist on type 'Element | Text'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
847
848
  textarea.selectionEnd = textarea.value.length;
848
849
  }
849
850
  };
@@ -862,7 +863,7 @@ class Editor extends React.Component<Props, State> {
862
863
  const widgetIds = _.intersection(this.widgetIds, _.keys(this.refs));
863
864
  _.each(widgetIds, (id) => {
864
865
  // eslint-disable-next-line react/no-string-refs
865
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
866
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
866
867
  widgets[id] = this.refs[id].serialize();
867
868
  });
868
869
 
@@ -932,7 +933,7 @@ class Editor extends React.Component<Props, State> {
932
933
  // Normal text
933
934
  underlayPieces.push(pieces[i]);
934
935
 
935
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 2 arguments, but got 1.
936
+ // @ts-expect-error - TS2554 - Expected 2 arguments, but got 1.
936
937
  const ast = PerseusMarkdown.parse(pieces[i]);
937
938
 
938
939
  PerseusMarkdown.traverseContent(ast, (node) => {
@@ -945,7 +946,7 @@ class Editor extends React.Component<Props, State> {
945
946
  } catch (e: any) {
946
947
  katexErrorList.push({
947
948
  math: content,
948
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'any' is not assignable to type 'never'.
949
+ // @ts-expect-error - TS2322 - Type 'any' is not assignable to type 'never'.
949
950
  message: e.message,
950
951
  });
951
952
  }
@@ -1001,7 +1002,7 @@ class Editor extends React.Component<Props, State> {
1001
1002
 
1002
1003
  const insertTemplateString = "Insert template\u2026";
1003
1004
  templatesDropDown = (
1004
- // @ts-expect-error [FEI-5003] - TS2322 - Type '(e: SyntheticEvent<HTMLTextAreaElement, Event>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
1005
+ // @ts-expect-error - TS2322 - Type '(e: SyntheticEvent<HTMLTextAreaElement, Event>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
1005
1006
  <select onChange={this.addTemplate}>
1006
1007
  <option value="">{insertTemplateString}</option>
1007
1008
  <option disabled>--</option>
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  /* eslint-disable @babel/no-invalid-this */
2
3
  /**
3
4
  * Collection of classes for rendering the hint editor area,
@@ -81,19 +82,19 @@ export class HintEditor extends React.Component<HintEditorProps> {
81
82
 
82
83
  focus: () => void = () => {
83
84
  // eslint-disable-next-line react/no-string-refs
84
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
85
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
85
86
  this.refs.editor.focus();
86
87
  };
87
88
 
88
89
  getSaveWarnings: () => any = () => {
89
90
  // eslint-disable-next-line react/no-string-refs
90
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
91
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
91
92
  return this.refs.editor.getSaveWarnings();
92
93
  };
93
94
 
94
95
  serialize: (options?: any) => any = (options: any) => {
95
96
  // eslint-disable-next-line react/no-string-refs
96
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
97
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
97
98
  return this.refs.editor.serialize(options);
98
99
  };
99
100
 
@@ -146,7 +147,7 @@ export class HintEditor extends React.Component<HintEditorProps> {
146
147
  )}
147
148
  <input
148
149
  type="checkbox"
149
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'boolean | null | undefined' is not assignable to type 'boolean | undefined'.
150
+ // @ts-expect-error - TS2322 - Type 'boolean | null | undefined' is not assignable to type 'boolean | undefined'.
150
151
  checked={this.props.replace}
151
152
  onChange={this.handleChange}
152
153
  />
@@ -204,7 +205,7 @@ class CombinedHintEditor extends React.Component<CombinedHintEditorProps> {
204
205
  this.props.isLast && !/\*\*/.test(this.props.hint.content);
205
206
 
206
207
  // eslint-disable-next-line react/no-string-refs
207
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
208
+ // @ts-expect-error - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
208
209
  this.refs.frame.sendNewData({
209
210
  type: "hint",
210
211
  data: {
@@ -223,19 +224,19 @@ class CombinedHintEditor extends React.Component<CombinedHintEditorProps> {
223
224
 
224
225
  getSaveWarnings = () => {
225
226
  // eslint-disable-next-line react/no-string-refs
226
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
227
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
227
228
  return this.refs.editor.getSaveWarnings();
228
229
  };
229
230
 
230
231
  serialize = (options: any) => {
231
232
  // eslint-disable-next-line react/no-string-refs
232
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
233
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
233
234
  return this.refs.editor.serialize(options);
234
235
  };
235
236
 
236
237
  focus = () => {
237
238
  // eslint-disable-next-line react/no-string-refs
238
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
239
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
239
240
  this.refs.editor.focus();
240
241
  };
241
242
 
@@ -340,15 +341,15 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
340
341
  newProps,
341
342
  );
342
343
 
343
- // @ts-expect-error [FEI-5003] - TS2740 - Type 'Hint' is missing the following properties from type 'readonly Hint[]': length, concat, join, slice, and 18 more.
344
+ // @ts-expect-error - TS2740 - Type 'Hint' is missing the following properties from type 'readonly Hint[]': length, concat, join, slice, and 18 more.
344
345
  this.props.onChange({hints: hints}, cb, silent);
345
346
  };
346
347
 
347
348
  handleHintRemove: (i: number) => void = (i: number) => {
348
349
  const hints = _(this.props.hints).clone();
349
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'splice' does not exist on type 'Hint'.
350
+ // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
350
351
  hints.splice(i, 1);
351
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
352
+ // @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
352
353
  this.props.onChange({hints: hints});
353
354
  };
354
355
 
@@ -357,14 +358,14 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
357
358
  dir: number,
358
359
  ) => {
359
360
  const hints = _(this.props.hints).clone();
360
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'splice' does not exist on type 'Hint'.
361
+ // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
361
362
  const hint = hints.splice(i, 1)[0];
362
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'splice' does not exist on type 'Hint'.
363
+ // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
363
364
  hints.splice(i + dir, 0, hint);
364
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
365
+ // @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
365
366
  this.props.onChange({hints: hints}, () => {
366
367
  // eslint-disable-next-line react/no-string-refs
367
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
368
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
368
369
  this.refs["hintEditor" + (i + dir)].focus();
369
370
  });
370
371
  };
@@ -372,12 +373,12 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
372
373
  addHint: () => void = () => {
373
374
  const hints = _(this.props.hints)
374
375
  .clone()
375
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'concat' does not exist on type 'Hint'.
376
+ // @ts-expect-error - TS2339 - Property 'concat' does not exist on type 'Hint'.
376
377
  .concat([{content: ""}]);
377
378
  this.props.onChange({hints: hints}, () => {
378
379
  const i = hints.length - 1;
379
380
  // eslint-disable-next-line react/no-string-refs
380
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
381
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
381
382
  this.refs["hintEditor" + i].focus();
382
383
  });
383
384
  };
@@ -387,7 +388,7 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
387
388
  .map((hint, i) => {
388
389
  return _.map(
389
390
  // eslint-disable-next-line react/no-string-refs
390
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
391
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
391
392
  this.refs["hintEditor" + i].getSaveWarnings(),
392
393
  (issue) => "Hint " + (i + 1) + ": " + issue,
393
394
  );
@@ -407,7 +408,7 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
407
408
  options: any,
408
409
  ): string => {
409
410
  // eslint-disable-next-line react/no-string-refs
410
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
411
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
411
412
  return this.refs["hintEditor" + index].serialize(options);
412
413
  };
413
414
 
@@ -425,24 +426,24 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
425
426
  itemId={itemId}
426
427
  hint={hint}
427
428
  pos={i}
428
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
429
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
429
430
  imageUploader={this.props.imageUploader}
430
431
  // eslint-disable-next-line react/jsx-no-bind
431
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
432
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
432
433
  onChange={this.handleHintChange.bind(this, i)}
433
434
  // eslint-disable-next-line react/jsx-no-bind
434
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
435
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
435
436
  onRemove={this.handleHintRemove.bind(this, i)}
436
437
  // eslint-disable-next-line react/jsx-no-bind
437
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
438
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
438
439
  onMove={this.handleHintMove.bind(this, i)}
439
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
440
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
440
441
  deviceType={this.props.deviceType}
441
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
442
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
442
443
  apiOptions={this.props.apiOptions}
443
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
444
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
444
445
  highlightLint={this.props.highlightLint}
445
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
446
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
446
447
  previewURL={this.props.previewURL}
447
448
  // TODO(CP-4838): what should be passed here?
448
449
  contentPaths={[]}
package/src/i18n.ts CHANGED
@@ -9,7 +9,7 @@ const {findContentNodesInItem, findHintNodesInItem, inferItemShape} =
9
9
 
10
10
  // Takes a renderer content and parses the markdown for images
11
11
  function findImagesInContent(content: any, images: Array<any>) {
12
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 2 arguments, but got 1.
12
+ // @ts-expect-error - TS2554 - Expected 2 arguments, but got 1.
13
13
  const parsed = PerseusMarkdown.parse(content);
14
14
 
15
15
  PerseusMarkdown.traverseContent(parsed, function (node) {
@@ -119,12 +119,12 @@ function findImagesInItemData(itemData: any): any {
119
119
  let renderers = [];
120
120
  if (itemData._multi) {
121
121
  const shape = inferItemShape(itemData);
122
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'ContentNode' is not assignable to parameter of type 'never'.
122
+ // @ts-expect-error - TS2345 - Argument of type 'ContentNode' is not assignable to parameter of type 'never'.
123
123
  findContentNodesInItem(itemData, shape, (node) => renderers.push(node));
124
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'HintNode' is not assignable to parameter of type 'never'.
124
+ // @ts-expect-error - TS2345 - Argument of type 'HintNode' is not assignable to parameter of type 'never'.
125
125
  findHintNodesInItem(itemData, shape, (node) => renderers.push(node));
126
126
  } else {
127
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'any' is not assignable to type 'never'. | TS2322 - Type 'any' is not assignable to type 'never'.
127
+ // @ts-expect-error - TS2322 - Type 'any' is not assignable to type 'never'. | TS2322 - Type 'any' is not assignable to type 'never'.
128
128
  renderers = [itemData.question, ...itemData.hints];
129
129
  }
130
130
  return findImagesInRenderers(renderers);
@@ -17,7 +17,7 @@ import * as React from "react";
17
17
  let nextIframeID = 0;
18
18
  const requestIframeData: Record<string, any> = {};
19
19
  const updateIframeHeight: Record<string, any> = {};
20
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'iframeDataStore' does not exist on type 'Window & typeof globalThis'.
20
+ // @ts-expect-error - TS2339 - Property 'iframeDataStore' does not exist on type 'Window & typeof globalThis'.
21
21
  window.iframeDataStore = {};
22
22
 
23
23
  // This is called once after Perseus is loaded and the iframe
@@ -66,12 +66,12 @@ type Props = {
66
66
 
67
67
  class IframeContentRenderer extends React.Component<Props> {
68
68
  _frame: HTMLIFrameElement | null | undefined;
69
- // @ts-expect-error [FEI-5003] - TS2564 - Property '_isMounted' has no initializer and is not definitely assigned in the constructor.
69
+ // @ts-expect-error - TS2564 - Property '_isMounted' has no initializer and is not definitely assigned in the constructor.
70
70
  _isMounted: boolean;
71
71
  _lastData: any;
72
- // @ts-expect-error [FEI-5003] - TS2564 - Property '_lastHeight' has no initializer and is not definitely assigned in the constructor.
72
+ // @ts-expect-error - TS2564 - Property '_lastHeight' has no initializer and is not definitely assigned in the constructor.
73
73
  _lastHeight: number;
74
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'iframeID' has no initializer and is not definitely assigned in the constructor.
74
+ // @ts-expect-error - TS2564 - Property 'iframeID' has no initializer and is not definitely assigned in the constructor.
75
75
  iframeID: number;
76
76
 
77
77
  componentDidMount() {
@@ -91,7 +91,7 @@ class IframeContentRenderer extends React.Component<Props> {
91
91
  this._lastHeight = height;
92
92
  if (this._isMounted && this.props.seamless) {
93
93
  // eslint-disable-next-line react/no-string-refs
94
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
94
+ // @ts-expect-error - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
95
95
  this.refs.container.style.height = height + "px";
96
96
  }
97
97
  };
@@ -107,11 +107,11 @@ class IframeContentRenderer extends React.Component<Props> {
107
107
  componentDidUpdate(prevProps: Props) {
108
108
  if (!this.props.seamless) {
109
109
  // eslint-disable-next-line react/no-string-refs
110
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
110
+ // @ts-expect-error - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
111
111
  this.refs.container.style.height = "100%";
112
112
  } else {
113
113
  // eslint-disable-next-line react/no-string-refs
114
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
114
+ // @ts-expect-error - TS2339 - Property 'style' does not exist on type 'ReactInstance'.
115
115
  this.refs.container.style.height = this._lastHeight + "px";
116
116
  }
117
117
 
@@ -132,7 +132,7 @@ class IframeContentRenderer extends React.Component<Props> {
132
132
  // Don't initialize the iframe until the page has loaded
133
133
  if (this._frame) {
134
134
  // eslint-disable-next-line react/no-string-refs
135
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'removeChild' does not exist on type 'ReactInstance'.
135
+ // @ts-expect-error - TS2339 - Property 'removeChild' does not exist on type 'ReactInstance'.
136
136
  this.refs.container.removeChild(this._frame);
137
137
  }
138
138
 
@@ -160,7 +160,7 @@ class IframeContentRenderer extends React.Component<Props> {
160
160
  }
161
161
 
162
162
  // eslint-disable-next-line react/no-string-refs
163
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'appendChild' does not exist on type 'ReactInstance'.
163
+ // @ts-expect-error - TS2339 - Property 'appendChild' does not exist on type 'ReactInstance'.
164
164
  this.refs.container.appendChild(frame);
165
165
 
166
166
  this._frame = frame;
@@ -174,7 +174,7 @@ class IframeContentRenderer extends React.Component<Props> {
174
174
  // We can't use JSON.stringify/parse for this because the apiOptions
175
175
  // includes the functions GroupMetadataEditor, groupAnnotator,
176
176
  // onFocusChange, and onInputError.
177
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'iframeDataStore' does not exist on type 'Window & typeof globalThis'.
177
+ // @ts-expect-error - TS2339 - Property 'iframeDataStore' does not exist on type 'Window & typeof globalThis'.
178
178
  window.iframeDataStore[this.iframeID] = data;
179
179
  frame.contentWindow.postMessage(this.iframeID, "*");
180
180
  }
@@ -51,7 +51,7 @@ class ItemEditor extends React.Component<Props> {
51
51
 
52
52
  triggerPreviewUpdate: (newData?: any) => void = (newData: any) => {
53
53
  // eslint-disable-next-line react/no-string-refs
54
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
54
+ // @ts-expect-error - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
55
55
  this.refs.frame.sendNewData(newData);
56
56
  };
57
57
 
@@ -67,7 +67,7 @@ class ItemEditor extends React.Component<Props> {
67
67
 
68
68
  getSaveWarnings: () => any = () => {
69
69
  // eslint-disable-next-line react/no-string-refs
70
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
70
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
71
71
  return this.refs.questionEditor.getSaveWarnings();
72
72
  };
73
73
 
@@ -81,10 +81,10 @@ class ItemEditor extends React.Component<Props> {
81
81
  } = (options: any) => {
82
82
  return {
83
83
  // eslint-disable-next-line react/no-string-refs
84
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
84
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
85
85
  question: this.refs.questionEditor.serialize(options),
86
86
  // eslint-disable-next-line react/no-string-refs
87
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
87
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
88
88
  answerArea: this.refs.itemExtrasEditor.serialize(options),
89
89
  itemDataVersion: ITEM_DATA_VERSION,
90
90
  };