@khanacademy/perseus-editor 2.6.1 → 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.
- package/CHANGELOG.md +13 -0
- package/dist/article-editor.d.ts +1 -2
- package/dist/components/form-wrapped-text-field.d.ts +1 -10
- package/dist/components/graph-points-count-selector.d.ts +1 -1
- package/dist/es/index.js +364 -364
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +366 -366
- package/dist/index.js.map +1 -1
- package/dist/widgets/input-number-editor.d.ts +1 -2
- package/dist/widgets/interactive-graph-editor.d.ts +48 -47
- package/package.json +12 -12
- package/src/__stories__/editor.stories.tsx +3 -1
- package/src/__tests__/i18n.test.ts +1 -1
- package/src/article-editor.tsx +13 -14
- package/src/components/checkbox.tsx +1 -1
- package/src/components/dropdown-option.tsx +12 -12
- package/src/components/form-wrapped-text-field.tsx +4 -2
- package/src/components/graph-points-count-selector.tsx +3 -1
- package/src/components/graph-settings.tsx +1 -1
- package/src/components/hover-behavior.ts +2 -2
- package/src/components/json-editor.tsx +2 -2
- package/src/components/sortable.tsx +1 -1
- package/src/components/util.ts +1 -1
- package/src/components/widget-editor.tsx +7 -7
- package/src/diffs/__tests__/structured-item-diff.test.ts +8 -8
- package/src/diffs/renderer-diff.tsx +3 -3
- package/src/diffs/split-diff.ts +2 -2
- package/src/diffs/structured-item-diff.tsx +10 -10
- package/src/diffs/text-diff.tsx +1 -1
- package/src/diffs/widget-diff.tsx +2 -2
- package/src/editor-page.tsx +8 -8
- package/src/editor.tsx +36 -36
- package/src/hint-editor.tsx +27 -27
- package/src/i18n.ts +4 -4
- package/src/iframe-content-renderer.tsx +10 -10
- package/src/item-editor.tsx +4 -4
- package/src/multirenderer-editor.tsx +11 -11
- package/src/widgets/categorizer-editor.tsx +3 -3
- package/src/widgets/cs-program-editor.tsx +2 -2
- package/src/widgets/definition-editor.tsx +2 -2
- package/src/widgets/dropdown-editor.tsx +8 -8
- package/src/widgets/example-graphie-widget-editor.tsx +1 -1
- package/src/widgets/example-graphie-widget.tsx +2 -2
- package/src/widgets/example-widget-editor.tsx +2 -2
- package/src/widgets/example-widget.tsx +3 -3
- package/src/widgets/explanation-editor.tsx +3 -3
- package/src/widgets/expression-editor.tsx +9 -9
- package/src/widgets/graded-group-editor.tsx +6 -6
- package/src/widgets/graded-group-set-editor.tsx +3 -3
- package/src/widgets/grapher-editor.tsx +2 -2
- package/src/widgets/group-editor.tsx +3 -3
- package/src/widgets/iframe-editor.tsx +4 -4
- package/src/widgets/input-number-editor.tsx +6 -6
- package/src/widgets/interaction-editor.tsx +102 -102
- package/src/widgets/interactive-graph-editor.tsx +12 -8
- package/src/widgets/label-image/marker.tsx +1 -1
- package/src/widgets/label-image/question-markers.tsx +1 -1
- package/src/widgets/lights-puzzle-editor.tsx +4 -4
- package/src/widgets/matrix-editor.tsx +2 -2
- package/src/widgets/measurer-editor.tsx +6 -6
- package/src/widgets/molecule-editor.tsx +2 -2
- package/src/widgets/number-line-editor.tsx +1 -1
- package/src/widgets/numeric-input-editor.tsx +2 -2
- package/src/widgets/orderer-editor.tsx +2 -2
- package/src/widgets/passage-editor.tsx +3 -3
- package/src/widgets/passage-ref-editor.tsx +3 -3
- package/src/widgets/passage-ref-target-editor.tsx +1 -1
- package/src/widgets/plotter-editor.tsx +4 -4
- package/src/widgets/radio/editor.tsx +3 -3
- package/src/widgets/reaction-diagram-editor.tsx +5 -5
- package/src/widgets/sequence-editor.tsx +1 -1
- package/src/widgets/simple-markdown-tester-editor.tsx +3 -3
- package/src/widgets/simple-markdown-tester.tsx +2 -2
- package/src/widgets/simulator-editor.tsx +1 -1
- package/src/widgets/sorter-editor.tsx +1 -1
- package/src/widgets/table-editor.tsx +1 -1
- package/src/widgets/transformer-editor.tsx +10 -10
- package/src/widgets/unit-editor.tsx +5 -5
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/all-editors.js.flow +0 -8
- package/dist/all-widgets.js.flow +0 -34
- package/dist/article-editor.js.flow +0 -72
- package/dist/components/blur-input.js.flow +0 -25
- package/dist/components/checkbox.js.flow +0 -26
- package/dist/components/device-framer.js.flow +0 -20
- package/dist/components/drag-target.js.flow +0 -8
- package/dist/components/dropdown-option.js.flow +0 -49
- package/dist/components/form-wrapped-text-field.js.flow +0 -45
- package/dist/components/graph-points-count-selector.js.flow +0 -12
- package/dist/components/graph-settings.js.flow +0 -8
- package/dist/components/graph-type-selector.js.flow +0 -12
- package/dist/components/hover-behavior.js.flow +0 -48
- package/dist/components/json-editor.js.flow +0 -8
- package/dist/components/link.js.flow +0 -50
- package/dist/components/section-control-button.js.flow +0 -25
- package/dist/components/segment-count-selector.js.flow +0 -11
- package/dist/components/simple-button.js.flow +0 -18
- package/dist/components/sortable.js.flow +0 -8
- package/dist/components/util.js.flow +0 -9
- package/dist/components/viewport-resizer.js.flow +0 -22
- package/dist/components/widget-editor.js.flow +0 -91
- package/dist/components/widget-select.js.flow +0 -16
- package/dist/diffs/article-diff.js.flow +0 -71
- package/dist/diffs/item-diff.js.flow +0 -41
- package/dist/diffs/renderer-diff.js.flow +0 -25
- package/dist/diffs/split-diff.js.flow +0 -8
- package/dist/diffs/string-array-diff.js.flow +0 -11
- package/dist/diffs/structured-item-diff.js.flow +0 -37
- package/dist/diffs/tags-diff.js.flow +0 -24
- package/dist/diffs/text-diff.js.flow +0 -21
- package/dist/diffs/widget-diff-performer.js.flow +0 -8
- package/dist/diffs/widget-diff.js.flow +0 -31
- package/dist/editor-page.js.flow +0 -72
- package/dist/editor.js.flow +0 -96
- package/dist/hint-editor.js.flow +0 -87
- package/dist/i18n.js.flow +0 -13
- package/dist/iframe-content-renderer.js.flow +0 -28
- package/dist/index.js.flow +0 -23
- package/dist/item-editor.js.flow +0 -46
- package/dist/item-extras-editor.js.flow +0 -23
- package/dist/katex-error-view.js.flow +0 -24
- package/dist/multirenderer-editor.js.flow +0 -46
- package/dist/stateful-article-editor.js.flow +0 -16
- package/dist/stateful-editor-page.js.flow +0 -8
- package/dist/testing-widgets.js.flow +0 -34
- package/dist/util/points.js.flow +0 -9
- package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +0 -7
- package/dist/widgets/categorizer-editor.js.flow +0 -62
- package/dist/widgets/cs-program-editor.js.flow +0 -25
- package/dist/widgets/definition-editor.js.flow +0 -23
- package/dist/widgets/dropdown-editor.js.flow +0 -37
- package/dist/widgets/example-graphie-widget-editor.js.flow +0 -25
- package/dist/widgets/example-graphie-widget.js.flow +0 -102
- package/dist/widgets/example-widget-editor.js.flow +0 -26
- package/dist/widgets/example-widget.js.flow +0 -86
- package/dist/widgets/explanation-editor.js.flow +0 -27
- package/dist/widgets/expression-editor.js.flow +0 -43
- package/dist/widgets/graded-group-editor.js.flow +0 -68
- package/dist/widgets/graded-group-set-editor.js.flow +0 -66
- package/dist/widgets/grapher-editor.js.flow +0 -21
- package/dist/widgets/group-editor.js.flow +0 -64
- package/dist/widgets/iframe-editor.js.flow +0 -24
- package/dist/widgets/image-editor.js.flow +0 -8
- package/dist/widgets/input-number-editor.js.flow +0 -77
- package/dist/widgets/interaction/constraint-editor.js.flow +0 -35
- package/dist/widgets/interaction-editor.js.flow +0 -36
- package/dist/widgets/interactive-graph-editor.js.flow +0 -5803
- package/dist/widgets/label-image/answer-choices.js.flow +0 -16
- package/dist/widgets/label-image/behavior.js.flow +0 -17
- package/dist/widgets/label-image/marker.js.flow +0 -32
- package/dist/widgets/label-image/question-markers.js.flow +0 -23
- package/dist/widgets/label-image/select-image.js.flow +0 -13
- package/dist/widgets/label-image-editor.js.flow +0 -44
- package/dist/widgets/lights-puzzle-editor.js.flow +0 -34
- package/dist/widgets/matcher-editor.js.flow +0 -28
- package/dist/widgets/matrix-editor.js.flow +0 -26
- package/dist/widgets/measurer-editor.js.flow +0 -42
- package/dist/widgets/molecule-editor.js.flow +0 -23
- package/dist/widgets/number-line-editor.js.flow +0 -45
- package/dist/widgets/numeric-input-editor.js.flow +0 -8
- package/dist/widgets/orderer-editor.js.flow +0 -30
- package/dist/widgets/passage-editor.js.flow +0 -24
- package/dist/widgets/passage-ref-editor.js.flow +0 -17
- package/dist/widgets/passage-ref-target-editor.js.flow +0 -22
- package/dist/widgets/plotter-editor.js.flow +0 -75
- package/dist/widgets/radio/editor.js.flow +0 -81
- package/dist/widgets/reaction-diagram-editor.js.flow +0 -26
- package/dist/widgets/sequence-editor.js.flow +0 -73
- package/dist/widgets/simple-markdown-tester-editor.js.flow +0 -23
- package/dist/widgets/simple-markdown-tester.js.flow +0 -61
- package/dist/widgets/simulator-editor.js.flow +0 -26
- package/dist/widgets/sorter-editor.js.flow +0 -22
- package/dist/widgets/table-editor.js.flow +0 -24
- package/dist/widgets/transformer-editor.js.flow +0 -17
- package/dist/widgets/unit-editor.js.flow +0 -41
- package/dist/widgets/video-editor.js.flow +0 -25
|
@@ -6,11 +6,8 @@ import {
|
|
|
6
6
|
InteractiveGraphWidget,
|
|
7
7
|
SizingUtils,
|
|
8
8
|
Util,
|
|
9
|
-
PerseusImageBackground,
|
|
10
|
-
PerseusInteractiveGraphWidgetOptions,
|
|
11
|
-
APIOptionsWithDefaults,
|
|
12
9
|
} from "@khanacademy/perseus";
|
|
13
|
-
import {
|
|
10
|
+
import {View} from "@khanacademy/wonder-blocks-core";
|
|
14
11
|
import Spacing from "@khanacademy/wonder-blocks-spacing";
|
|
15
12
|
import * as Typography from "@khanacademy/wonder-blocks-typography";
|
|
16
13
|
import * as React from "react";
|
|
@@ -22,6 +19,13 @@ import GraphTypeSelector from "../components/graph-type-selector";
|
|
|
22
19
|
import SegmentCountSelector from "../components/segment-count-selector";
|
|
23
20
|
import {parsePointCount} from "../util/points";
|
|
24
21
|
|
|
22
|
+
import type {
|
|
23
|
+
PerseusImageBackground,
|
|
24
|
+
PerseusInteractiveGraphWidgetOptions,
|
|
25
|
+
APIOptionsWithDefaults,
|
|
26
|
+
} from "@khanacademy/perseus";
|
|
27
|
+
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
28
|
+
|
|
25
29
|
const {InfoTip} = components;
|
|
26
30
|
const {containerSizeClass, getInteractiveBoxFromSizeClass} = SizingUtils;
|
|
27
31
|
const DeprecationMixin = Util.DeprecationMixin;
|
|
@@ -168,7 +172,7 @@ class InteractiveGraphEditor extends React.Component<Props> {
|
|
|
168
172
|
trackInteraction: function () {},
|
|
169
173
|
onChange: (newProps: InteractiveGraphProps) => {
|
|
170
174
|
let correct = this.props.correct;
|
|
171
|
-
// @ts-expect-error
|
|
175
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
172
176
|
if (correct.type === newProps.graph.type) {
|
|
173
177
|
correct = _.extend({}, correct, newProps.graph);
|
|
174
178
|
} else {
|
|
@@ -182,7 +186,7 @@ class InteractiveGraphEditor extends React.Component<Props> {
|
|
|
182
186
|
// There are a bunch of props that renderer.jsx passes to widgets via
|
|
183
187
|
// getWidgetProps() and widget-container.jsx that the editors don't
|
|
184
188
|
// bother passing.
|
|
185
|
-
// @ts-expect-error
|
|
189
|
+
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
186
190
|
<InteractiveGraph
|
|
187
191
|
{...graphProps}
|
|
188
192
|
containerSizeClass={sizeClass}
|
|
@@ -194,7 +198,7 @@ class InteractiveGraphEditor extends React.Component<Props> {
|
|
|
194
198
|
);
|
|
195
199
|
// TODO(kevinb): Update getEquationString to only accept the data it actually
|
|
196
200
|
// needs to compute the equation string.
|
|
197
|
-
// @ts-expect-error
|
|
201
|
+
// @ts-expect-error - TS2345 - Argument of type '{ readonly ref: "graph"; readonly box: any; readonly range: any; readonly labels: any; readonly step: any; readonly gridStep: any; readonly snapStep: any; readonly graph: any; readonly backgroundImage: any; ... 6 more ...; readonly onChange: (newProps: Pick<...> & ... 1 more ... & InexactPartial<...>) => void; }' is not assignable to parameter of type 'Props'.
|
|
198
202
|
equationString = InteractiveGraph.getEquationString(graphProps);
|
|
199
203
|
} else {
|
|
200
204
|
graph = <div className="perseus-error">{this.props.valid}</div>;
|
|
@@ -556,7 +560,7 @@ class InteractiveGraphEditor extends React.Component<Props> {
|
|
|
556
560
|
],
|
|
557
561
|
function (key) {
|
|
558
562
|
if (_.has(correct, key)) {
|
|
559
|
-
// @ts-expect-error
|
|
563
|
+
// @ts-expect-error - TS2339 - Property 'graph' does not exist on type 'Pick<any, "step" | "range" | "backgroundImage" | "snapStep" | "labels" | "showTooltips" | "markings" | "gridStep" | "showProtractor" | "showRuler" | "rulerLabel" | "rulerTicks">'.
|
|
560
564
|
json.graph[key] = correct[key];
|
|
561
565
|
}
|
|
562
566
|
},
|
|
@@ -163,7 +163,7 @@ export default class Marker extends React.Component<Props, State> {
|
|
|
163
163
|
<OptionGroup
|
|
164
164
|
onSelected={this.handleSelectAnswer}
|
|
165
165
|
// TODO(WB-1096): make selectedValues immutable in wonder-blocks
|
|
166
|
-
// @ts-expect-error
|
|
166
|
+
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
167
167
|
selectedValues={answers}
|
|
168
168
|
>
|
|
169
169
|
{choices.map((choice) => (
|
|
@@ -33,7 +33,7 @@ export default class QuestionMarkers extends React.Component<Props> {
|
|
|
33
33
|
// Open answer selection dropdown for each of the specified markers.
|
|
34
34
|
indices.forEach((index) => {
|
|
35
35
|
if (this._markers[index]) {
|
|
36
|
-
// @ts-expect-error
|
|
36
|
+
// @ts-expect-error - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37
37
|
this._markers[index].openDropdown();
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -192,7 +192,7 @@ class LightsPuzzleEditor extends React.Component<LightsPuzzleEditorProps> {
|
|
|
192
192
|
Flip pattern:
|
|
193
193
|
<select
|
|
194
194
|
value={this.props.flipPattern}
|
|
195
|
-
// @ts-expect-error
|
|
195
|
+
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
196
196
|
onChange={this._handlePatternChange}
|
|
197
197
|
>
|
|
198
198
|
{_.map(_.keys(PATTERNS), (pattern, i) => {
|
|
@@ -230,7 +230,7 @@ class LightsPuzzleEditor extends React.Component<LightsPuzzleEditorProps> {
|
|
|
230
230
|
|
|
231
231
|
_handlePatternChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void =
|
|
232
232
|
(e) => {
|
|
233
|
-
// @ts-expect-error
|
|
233
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
234
234
|
this.change("flipPattern", e.target.value);
|
|
235
235
|
};
|
|
236
236
|
|
|
@@ -257,7 +257,7 @@ class LightsPuzzleEditor extends React.Component<LightsPuzzleEditorProps> {
|
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
259
|
|
|
260
|
-
// @ts-expect-error
|
|
260
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
261
261
|
this.change({startCells: newCells});
|
|
262
262
|
};
|
|
263
263
|
|
|
@@ -266,7 +266,7 @@ class LightsPuzzleEditor extends React.Component<LightsPuzzleEditorProps> {
|
|
|
266
266
|
return y === tileY && x === tileX;
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
// @ts-expect-error
|
|
269
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
270
270
|
this.change({startCells: newCells});
|
|
271
271
|
};
|
|
272
272
|
|
|
@@ -99,7 +99,7 @@ class MatrixEditor extends React.Component<Props> {
|
|
|
99
99
|
content={this.props.prefix}
|
|
100
100
|
widgetEnabled={false}
|
|
101
101
|
onChange={(newProps) => {
|
|
102
|
-
// @ts-expect-error
|
|
102
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
103
103
|
this.change({prefix: newProps.content});
|
|
104
104
|
}}
|
|
105
105
|
/>
|
|
@@ -114,7 +114,7 @@ class MatrixEditor extends React.Component<Props> {
|
|
|
114
114
|
content={this.props.suffix}
|
|
115
115
|
widgetEnabled={false}
|
|
116
116
|
onChange={(newProps) => {
|
|
117
|
-
// @ts-expect-error
|
|
117
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
118
118
|
this.change({suffix: newProps.content});
|
|
119
119
|
}}
|
|
120
120
|
/>
|
|
@@ -95,7 +95,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
95
95
|
<div>
|
|
96
96
|
Containing area [width, height]:{" "}
|
|
97
97
|
<RangeInput
|
|
98
|
-
// @ts-expect-error
|
|
98
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
99
99
|
onChange={this.change("box")}
|
|
100
100
|
value={this.props.box}
|
|
101
101
|
useArrowKeys={true}
|
|
@@ -125,7 +125,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
125
125
|
Ruler label:{" "}
|
|
126
126
|
<select
|
|
127
127
|
onChange={(e) =>
|
|
128
|
-
// @ts-expect-error
|
|
128
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
129
129
|
this.change(
|
|
130
130
|
"rulerLabel",
|
|
131
131
|
e.target.value,
|
|
@@ -159,7 +159,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
159
159
|
Ruler ticks:{" "}
|
|
160
160
|
<select
|
|
161
161
|
onChange={(e) =>
|
|
162
|
-
// @ts-expect-error
|
|
162
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
163
163
|
this.change(
|
|
164
164
|
"rulerTicks",
|
|
165
165
|
+e.target.value,
|
|
@@ -182,7 +182,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
182
182
|
Ruler pixels per unit:{" "}
|
|
183
183
|
<NumberInput
|
|
184
184
|
placeholder={40}
|
|
185
|
-
// @ts-expect-error
|
|
185
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
186
186
|
onChange={this.change("rulerPixels")}
|
|
187
187
|
value={this.props.rulerPixels}
|
|
188
188
|
useArrowKeys={true}
|
|
@@ -194,7 +194,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
194
194
|
Ruler length in units:{" "}
|
|
195
195
|
<NumberInput
|
|
196
196
|
placeholder={10}
|
|
197
|
-
// @ts-expect-error
|
|
197
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
198
198
|
onChange={this.change("rulerLength")}
|
|
199
199
|
value={this.props.rulerLength}
|
|
200
200
|
useArrowKeys={true}
|
|
@@ -226,7 +226,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
226
226
|
_changeImage: (arg1: string, arg2: any) => void = (subProp, newValue) => {
|
|
227
227
|
const image = _.clone(this.props.image);
|
|
228
228
|
image[subProp] = newValue;
|
|
229
|
-
// @ts-expect-error
|
|
229
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
230
230
|
this.change("image", image);
|
|
231
231
|
};
|
|
232
232
|
|
|
@@ -20,12 +20,12 @@ class MoleculeWidgetEditor extends React.Component<Props> {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
updateMolecule: (arg1: string) => void = (newValue) => {
|
|
23
|
-
// @ts-expect-error
|
|
23
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
24
24
|
this.change({smiles: newValue});
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
updateRotation: (arg1: string) => void = (newValue) => {
|
|
28
|
-
// @ts-expect-error
|
|
28
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
29
29
|
this.change({rotationAngle: newValue});
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -212,7 +212,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
212
212
|
Correct x{" "}
|
|
213
213
|
<select
|
|
214
214
|
value={this.props.correctRel}
|
|
215
|
-
// @ts-expect-error
|
|
215
|
+
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
216
216
|
onChange={this.onChangeRelation}
|
|
217
217
|
>
|
|
218
218
|
<option value="eq"> = </option>
|
|
@@ -508,7 +508,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
508
508
|
// TODO(emily): This doesn't actually work, because the value is either
|
|
509
509
|
// null or undefined when undefined, probably.
|
|
510
510
|
if (_.contains(_.pluck(this.props.answers, "value"), "")) {
|
|
511
|
-
// @ts-expect-error
|
|
511
|
+
// @ts-expect-error - TS2345 - Argument of type 'string' is not assignable to parameter of type 'never'.
|
|
512
512
|
warnings.push("One or more answers is empty");
|
|
513
513
|
}
|
|
514
514
|
this.props.answers.forEach((answer, i) => {
|
|
@@ -517,7 +517,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
517
517
|
(!answer.answerForms || answer.answerForms.length === 0);
|
|
518
518
|
if (formatError) {
|
|
519
519
|
warnings.push(
|
|
520
|
-
// @ts-expect-error
|
|
520
|
+
// @ts-expect-error - TS2345 - Argument of type 'string' is not assignable to parameter of type 'never'.
|
|
521
521
|
`Answer ${i + 1} is set to string format ` +
|
|
522
522
|
"matching, but no format was selected",
|
|
523
523
|
);
|
|
@@ -74,7 +74,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
74
74
|
Layout:{" "}
|
|
75
75
|
<select
|
|
76
76
|
value={this.props.layout}
|
|
77
|
-
// @ts-expect-error
|
|
77
|
+
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
78
78
|
onChange={this.onLayoutChange}
|
|
79
79
|
>
|
|
80
80
|
<option value={HORIZONTAL}>Horizontal</option>
|
|
@@ -95,7 +95,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
95
95
|
Height:{" "}
|
|
96
96
|
<select
|
|
97
97
|
value={this.props.height}
|
|
98
|
-
// @ts-expect-error
|
|
98
|
+
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
99
99
|
onChange={this.onHeightChange}
|
|
100
100
|
>
|
|
101
101
|
<option value={NORMAL}>Normal</option>
|
|
@@ -45,7 +45,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
45
45
|
widgetEnabled={false}
|
|
46
46
|
placeholder="Type passage here..."
|
|
47
47
|
onChange={(newProps) => {
|
|
48
|
-
// @ts-expect-error
|
|
48
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
49
49
|
this.change({passageText: newProps.content});
|
|
50
50
|
}}
|
|
51
51
|
showWordCount={true}
|
|
@@ -60,7 +60,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
60
60
|
widgetEnabled={false}
|
|
61
61
|
placeholder="Type footnotes here..."
|
|
62
62
|
onChange={(newProps) => {
|
|
63
|
-
// @ts-expect-error
|
|
63
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
64
64
|
this.change({footnotes: newProps.content});
|
|
65
65
|
}}
|
|
66
66
|
/>
|
|
@@ -88,7 +88,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
88
88
|
type="text"
|
|
89
89
|
defaultValue={this.props.passageTitle}
|
|
90
90
|
onChange={(e) => {
|
|
91
|
-
// @ts-expect-error
|
|
91
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
92
92
|
this.change({passageTitle: e.target.value});
|
|
93
93
|
}}
|
|
94
94
|
/>
|
|
@@ -39,7 +39,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
39
39
|
{"Passage Number: "}
|
|
40
40
|
<NumberInput
|
|
41
41
|
value={this.props.passageNumber}
|
|
42
|
-
// @ts-expect-error
|
|
42
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
43
43
|
onChange={this.change("passageNumber")}
|
|
44
44
|
/>
|
|
45
45
|
</label>
|
|
@@ -49,7 +49,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
49
49
|
{"Reference Number: "}
|
|
50
50
|
<NumberInput
|
|
51
51
|
value={this.props.referenceNumber}
|
|
52
|
-
// @ts-expect-error
|
|
52
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
53
53
|
onChange={this.change("referenceNumber")}
|
|
54
54
|
/>
|
|
55
55
|
</label>
|
|
@@ -59,7 +59,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
59
59
|
{"Summary Text: "}
|
|
60
60
|
<TextInput
|
|
61
61
|
value={this.props.summaryText}
|
|
62
|
-
// @ts-expect-error
|
|
62
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
63
63
|
onChange={this.change("summaryText")}
|
|
64
64
|
/>
|
|
65
65
|
<InfoTip>
|
|
@@ -24,7 +24,7 @@ class PassageRefTargetEditor extends React.Component<Props> {
|
|
|
24
24
|
handleContentChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
25
25
|
e,
|
|
26
26
|
) => {
|
|
27
|
-
// @ts-expect-error
|
|
27
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
28
28
|
this.change({content: e.target.value});
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -200,7 +200,7 @@ class PlotterEditor extends React.Component<Props, State> {
|
|
|
200
200
|
if (categories) {
|
|
201
201
|
// eslint-disable-next-line react/no-string-refs
|
|
202
202
|
const node = ReactDOM.findDOMNode(this.refs.categories);
|
|
203
|
-
// @ts-expect-error
|
|
203
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
204
204
|
node.value = categories.join(", ");
|
|
205
205
|
}
|
|
206
206
|
};
|
|
@@ -252,7 +252,7 @@ class PlotterEditor extends React.Component<Props, State> {
|
|
|
252
252
|
starting: _.map(this.props.starting, scale),
|
|
253
253
|
});
|
|
254
254
|
|
|
255
|
-
// @ts-expect-error
|
|
255
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
256
256
|
ReactDOM.findDOMNode(this.refs.maxY).value = maxY; // eslint-disable-line react/no-string-refs
|
|
257
257
|
};
|
|
258
258
|
|
|
@@ -294,7 +294,7 @@ class PlotterEditor extends React.Component<Props, State> {
|
|
|
294
294
|
// eslint-disable-next-line react/no-string-refs
|
|
295
295
|
const node = ReactDOM.findDOMNode(this.refs.categories);
|
|
296
296
|
|
|
297
|
-
// @ts-expect-error
|
|
297
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
298
298
|
node.value = categories.join(", ");
|
|
299
299
|
};
|
|
300
300
|
|
|
@@ -313,7 +313,7 @@ class PlotterEditor extends React.Component<Props, State> {
|
|
|
313
313
|
);
|
|
314
314
|
|
|
315
315
|
if (this.props.type === PIC) {
|
|
316
|
-
// @ts-expect-error
|
|
316
|
+
// @ts-expect-error - TS2339 - Property 'picUrl' does not exist on type 'Pick<Readonly<any> & Readonly<{ children?: ReactNode; }>, "type" | "correct" | "labels" | "categories" | "starting" | "scaleY" | "maxY" | "snapsPerLine" | "labelInterval">'.
|
|
317
317
|
json.picUrl = this.props.picUrl;
|
|
318
318
|
}
|
|
319
319
|
|
|
@@ -248,7 +248,7 @@ class RadioEditor extends React.Component<any> {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
|
|
251
|
-
// @ts-expect-error
|
|
251
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
|
|
252
252
|
return Changeable.change.apply(this, args);
|
|
253
253
|
};
|
|
254
254
|
|
|
@@ -355,7 +355,7 @@ class RadioEditor extends React.Component<any> {
|
|
|
355
355
|
},
|
|
356
356
|
() => {
|
|
357
357
|
// eslint-disable-next-line react/no-string-refs
|
|
358
|
-
// @ts-expect-error
|
|
358
|
+
// @ts-expect-error - TS2339 - Property 'refs' does not exist on type 'ReactInstance'.
|
|
359
359
|
this.refs[`choice-editor${addIndex}`].refs[
|
|
360
360
|
"content-editor"
|
|
361
361
|
].focus();
|
|
@@ -369,7 +369,7 @@ class RadioEditor extends React.Component<any> {
|
|
|
369
369
|
|
|
370
370
|
focus: () => boolean = () => {
|
|
371
371
|
// eslint-disable-next-line react/no-string-refs
|
|
372
|
-
// @ts-expect-error
|
|
372
|
+
// @ts-expect-error - TS2339 - Property 'refs' does not exist on type 'ReactInstance'.
|
|
373
373
|
this.refs["choice-editor0"].refs["content-editor"].focus();
|
|
374
374
|
return true;
|
|
375
375
|
};
|
|
@@ -29,20 +29,20 @@ class ReactionDiagramWidgetEditor extends React.Component<Props> {
|
|
|
29
29
|
|
|
30
30
|
updateMolecule: (arg1: number) => (arg1: string) => void = (idx) => {
|
|
31
31
|
return function (newValue: string) {
|
|
32
|
-
// @ts-expect-error
|
|
32
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
33
33
|
const newSmiles = [...this.props.smiles];
|
|
34
34
|
newSmiles[idx] = newValue;
|
|
35
|
-
// @ts-expect-error
|
|
35
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
36
36
|
this.change({smiles: newSmiles});
|
|
37
37
|
}.bind(this);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
updateRotation: (arg1: number) => (arg1: any) => void = (idx) => {
|
|
41
41
|
return function (newValue) {
|
|
42
|
-
// @ts-expect-error
|
|
42
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
43
43
|
const newRot = [...this.props.rotationAngle];
|
|
44
44
|
newRot[idx] = newValue;
|
|
45
|
-
// @ts-expect-error
|
|
45
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
46
46
|
this.change({rotationAngle: newRot});
|
|
47
47
|
}.bind(this);
|
|
48
48
|
};
|
|
@@ -56,7 +56,7 @@ class ReactionDiagramWidgetEditor extends React.Component<Props> {
|
|
|
56
56
|
return {...sep};
|
|
57
57
|
});
|
|
58
58
|
newSep[idx][propName] = newValue;
|
|
59
|
-
// @ts-expect-error
|
|
59
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
60
60
|
this.change({separators: newSep});
|
|
61
61
|
};
|
|
62
62
|
};
|
|
@@ -139,7 +139,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
|
|
|
139
139
|
return {
|
|
140
140
|
json: _.times(this.props.json.length, (i) => {
|
|
141
141
|
// eslint-disable-next-line react/no-string-refs
|
|
142
|
-
// @ts-expect-error
|
|
142
|
+
// @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
|
|
143
143
|
return this.refs["editor" + i].serialize();
|
|
144
144
|
}),
|
|
145
145
|
};
|
|
@@ -24,7 +24,7 @@ class TextArea extends React.Component<TextAreaProps> {
|
|
|
24
24
|
|
|
25
25
|
focus = () => {
|
|
26
26
|
// eslint-disable-next-line react/no-string-refs
|
|
27
|
-
// @ts-expect-error
|
|
27
|
+
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
28
28
|
this.refs.input.focus();
|
|
29
29
|
return true;
|
|
30
30
|
};
|
|
@@ -57,7 +57,7 @@ class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEdi
|
|
|
57
57
|
<div>
|
|
58
58
|
<TextArea
|
|
59
59
|
value={this.props.value}
|
|
60
|
-
// @ts-expect-error
|
|
60
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
61
61
|
onChange={this.change("value")}
|
|
62
62
|
// eslint-disable-next-line react/no-string-refs
|
|
63
63
|
ref="input"
|
|
@@ -74,7 +74,7 @@ class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEdi
|
|
|
74
74
|
|
|
75
75
|
focus: () => boolean = () => {
|
|
76
76
|
// eslint-disable-next-line react/no-string-refs
|
|
77
|
-
// @ts-expect-error
|
|
77
|
+
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
78
78
|
this.refs.input.focus();
|
|
79
79
|
return true;
|
|
80
80
|
};
|
|
@@ -45,7 +45,7 @@ class SimpleMarkdownTester extends React.Component<Props> {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
render(): React.ReactNode {
|
|
48
|
-
// @ts-expect-error
|
|
48
|
+
// @ts-expect-error - TS2554 - Expected 2 arguments, but got 1.
|
|
49
49
|
const parsed = mdParse(this.props.value);
|
|
50
50
|
const output = mdOutput(parsed);
|
|
51
51
|
return <div>{output}</div>;
|
|
@@ -58,7 +58,7 @@ class SimpleMarkdownTester extends React.Component<Props> {
|
|
|
58
58
|
*/
|
|
59
59
|
focus: () => boolean = () => {
|
|
60
60
|
// eslint-disable-next-line react/no-string-refs
|
|
61
|
-
// @ts-expect-error
|
|
61
|
+
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
62
62
|
this.refs.input.focus();
|
|
63
63
|
return true;
|
|
64
64
|
};
|
|
@@ -127,7 +127,7 @@ class SimulatorEditor extends React.Component<Props> {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
|
|
130
|
-
// @ts-expect-error
|
|
130
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
|
|
131
131
|
return Changeable.change.apply(this, args);
|
|
132
132
|
};
|
|
133
133
|
|
|
@@ -68,7 +68,7 @@ class SorterEditor extends React.Component<Props> {
|
|
|
68
68
|
Layout:{" "}
|
|
69
69
|
<select
|
|
70
70
|
value={this.props.layout}
|
|
71
|
-
// @ts-expect-error
|
|
71
|
+
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
72
72
|
onChange={this.onLayoutChange}
|
|
73
73
|
>
|
|
74
74
|
<option value={HORIZONTAL}>Horizontal</option>
|
|
@@ -37,7 +37,7 @@ class TableEditor extends React.Component<Props> {
|
|
|
37
37
|
})();
|
|
38
38
|
|
|
39
39
|
focus: () => void = () => {
|
|
40
|
-
// @ts-expect-error
|
|
40
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
41
41
|
ReactDOM.findDOMNode(this.refs.numberOfColumns).focus(); // eslint-disable-line react/no-string-refs
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -652,7 +652,7 @@ const ShapeTypes: any = {
|
|
|
652
652
|
const coord0 = points[0].coord || points[0];
|
|
653
653
|
const coord1 = points[1].coord || points[1];
|
|
654
654
|
const radius = kpoint.distanceToPoint(coord0, coord1);
|
|
655
|
-
// @ts-expect-error
|
|
655
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
656
656
|
perimeter.remove();
|
|
657
657
|
perimeter = graphie.circle(
|
|
658
658
|
coord0,
|
|
@@ -677,7 +677,7 @@ const ShapeTypes: any = {
|
|
|
677
677
|
remove: function () {
|
|
678
678
|
// Not _.bind because the remove function changes
|
|
679
679
|
// when the perimeter is redrawn
|
|
680
|
-
// @ts-expect-error
|
|
680
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
681
681
|
perimeter.remove();
|
|
682
682
|
},
|
|
683
683
|
};
|
|
@@ -726,10 +726,10 @@ const ShapeTypes: any = {
|
|
|
726
726
|
const line2_2 = [points2[1], points2[2]];
|
|
727
727
|
|
|
728
728
|
const equalUnflipped =
|
|
729
|
-
// @ts-expect-error
|
|
729
|
+
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
|
|
730
730
|
kray.equal(line1_0, line2_0) && kray.equal(line1_2, line2_2);
|
|
731
731
|
const equalFlipped =
|
|
732
|
-
// @ts-expect-error
|
|
732
|
+
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
|
|
733
733
|
kray.equal(line1_0, line2_2) && kray.equal(line1_2, line2_0);
|
|
734
734
|
|
|
735
735
|
return equalUnflipped || equalFlipped;
|
|
@@ -817,7 +817,7 @@ class TransformationsShapeEditor extends React.Component<any> {
|
|
|
817
817
|
);
|
|
818
818
|
|
|
819
819
|
// eslint-disable-next-line react/no-string-refs
|
|
820
|
-
// @ts-expect-error
|
|
820
|
+
// @ts-expect-error - TS2339 - Property 'props' does not exist on type 'ReactInstance'.
|
|
821
821
|
const radius = scaleToRange(4, this.refs.graph.props.range);
|
|
822
822
|
const offset = (1 / 2 - 1 / pointCount) * 180;
|
|
823
823
|
const coords = _.times(pointCount, function (i) {
|
|
@@ -838,27 +838,27 @@ class TransformationsShapeEditor extends React.Component<any> {
|
|
|
838
838
|
|
|
839
839
|
componentDidMount() {
|
|
840
840
|
// eslint-disable-next-line react/no-string-refs
|
|
841
|
-
// @ts-expect-error
|
|
841
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
842
842
|
this.setupGraphie(this.refs.graph.graphie());
|
|
843
843
|
}
|
|
844
844
|
|
|
845
845
|
componentDidUpdate(prevProps) {
|
|
846
846
|
if (!deepEq(prevProps.shape, this.props.shape)) {
|
|
847
847
|
// eslint-disable-next-line react/no-string-refs
|
|
848
|
-
// @ts-expect-error
|
|
848
|
+
// @ts-expect-error - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
|
|
849
849
|
this.refs.graph.reset();
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
updateCoords = () => {
|
|
854
854
|
this.props.onChange({
|
|
855
|
-
// @ts-expect-error
|
|
855
|
+
// @ts-expect-error - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
|
|
856
856
|
shape: this.shape.toJSON(),
|
|
857
857
|
});
|
|
858
858
|
};
|
|
859
859
|
|
|
860
860
|
setupGraphie = (graphie: any) => {
|
|
861
|
-
// @ts-expect-error
|
|
861
|
+
// @ts-expect-error - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
|
|
862
862
|
this.shape = ShapeTypes.addMovableShape(graphie, {
|
|
863
863
|
editable: true,
|
|
864
864
|
snap: graphie.snap,
|
|
@@ -996,7 +996,7 @@ class TransformerEditor extends React.Component<any> {
|
|
|
996
996
|
|
|
997
997
|
serialize: () => any = () => {
|
|
998
998
|
// eslint-disable-next-line react/no-string-refs
|
|
999
|
-
// @ts-expect-error
|
|
999
|
+
// @ts-expect-error - TS2339 - Property 'getEditorJSON' does not exist on type 'ReactInstance'.
|
|
1000
1000
|
const json = this.refs.explorer.getEditorJSON();
|
|
1001
1001
|
json.correct = json.answer;
|
|
1002
1002
|
delete json.answer;
|