@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.
- package/CHANGELOG.md +24 -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 +414 -436
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +411 -435
- 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/dist/widgets/plotter-editor.d.ts +47 -23
- 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 +2 -1
- package/src/components/dropdown-option.tsx +13 -12
- package/src/components/form-wrapped-text-field.tsx +5 -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 +8 -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 +11 -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 +37 -36
- package/src/hint-editor.tsx +28 -27
- package/src/i18n.ts +4 -4
- package/src/iframe-content-renderer.tsx +10 -10
- package/src/item-editor.tsx +4 -4
- package/src/katex-mhchem/parser.js +24 -24
- package/src/multirenderer-editor.tsx +11 -11
- package/src/widgets/__stories__/label-image-editor.stories.tsx +1 -0
- package/src/widgets/__stories__/radio-editor.stories.tsx +1 -0
- package/src/widgets/categorizer-editor.tsx +3 -3
- package/src/widgets/cs-program-editor.tsx +2 -2
- package/src/widgets/definition-editor.tsx +3 -2
- package/src/widgets/dropdown-editor.tsx +9 -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 +4 -3
- package/src/widgets/explanation-editor.tsx +4 -3
- package/src/widgets/expression-editor.tsx +9 -9
- package/src/widgets/graded-group-editor.tsx +7 -6
- package/src/widgets/graded-group-set-editor.tsx +3 -3
- package/src/widgets/grapher-editor.tsx +3 -2
- package/src/widgets/group-editor.tsx +4 -3
- package/src/widgets/iframe-editor.tsx +5 -4
- package/src/widgets/input-number-editor.tsx +6 -6
- package/src/widgets/interaction-editor.tsx +103 -102
- package/src/widgets/interactive-graph-editor.tsx +12 -8
- package/src/widgets/label-image/marker.tsx +2 -1
- package/src/widgets/label-image/question-markers.tsx +1 -1
- package/src/widgets/lights-puzzle-editor.tsx +5 -4
- package/src/widgets/matrix-editor.tsx +2 -2
- package/src/widgets/measurer-editor.tsx +7 -6
- package/src/widgets/molecule-editor.tsx +2 -2
- package/src/widgets/number-line-editor.tsx +2 -1
- package/src/widgets/numeric-input-editor.tsx +2 -2
- package/src/widgets/orderer-editor.tsx +3 -2
- package/src/widgets/passage-editor.tsx +3 -3
- package/src/widgets/passage-ref-editor.tsx +4 -3
- package/src/widgets/passage-ref-target-editor.tsx +1 -1
- package/src/widgets/plotter-editor.tsx +253 -243
- 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 +4 -3
- package/src/widgets/simple-markdown-tester.tsx +2 -2
- package/src/widgets/simulator-editor.tsx +1 -1
- package/src/widgets/sorter-editor.tsx +2 -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 -53
- 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
|
@@ -9,7 +9,7 @@ import GradedGroupEditor from "./graded-group-editor";
|
|
|
9
9
|
type Props = any;
|
|
10
10
|
|
|
11
11
|
class GradedGroupSetEditor extends React.Component<Props> {
|
|
12
|
-
// @ts-expect-error
|
|
12
|
+
// @ts-expect-error - TS2564 - Property '_editors' has no initializer and is not definitely assigned in the constructor.
|
|
13
13
|
_editors: Array<any>;
|
|
14
14
|
|
|
15
15
|
static propTypes = {
|
|
@@ -63,7 +63,7 @@ class GradedGroupSetEditor extends React.Component<Props> {
|
|
|
63
63
|
widgetEnabled={true}
|
|
64
64
|
immutableWidgets={false}
|
|
65
65
|
onChange={(data) =>
|
|
66
|
-
// @ts-expect-error
|
|
66
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
67
67
|
this.change(
|
|
68
68
|
"gradedGroups",
|
|
69
69
|
setArrayItem(this.props.gradedGroups, i, {
|
|
@@ -78,7 +78,7 @@ class GradedGroupSetEditor extends React.Component<Props> {
|
|
|
78
78
|
|
|
79
79
|
addGroup: () => void = () => {
|
|
80
80
|
const groups = this.props.gradedGroups || [];
|
|
81
|
-
// @ts-expect-error
|
|
81
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
82
82
|
this.change(
|
|
83
83
|
"gradedGroups",
|
|
84
84
|
groups.concat([GradedGroupEditor.defaultProps]),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
1
2
|
/* eslint-disable react/sort-comp */
|
|
2
3
|
import {
|
|
3
4
|
components,
|
|
@@ -68,7 +69,7 @@ class GrapherEditor extends React.Component<Props> {
|
|
|
68
69
|
// NOTE(jeremy): This editor doesn't pass in a bunch of
|
|
69
70
|
// standard props that the Renderer provides normally (eg.
|
|
70
71
|
// alignment, findWidgets, etc).
|
|
71
|
-
// @ts-expect-error
|
|
72
|
+
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
72
73
|
<Grapher
|
|
73
74
|
{...graphProps}
|
|
74
75
|
apiOptions={this.props.apiOptions}
|
|
@@ -110,7 +111,7 @@ class GrapherEditor extends React.Component<Props> {
|
|
|
110
111
|
rulerLabel={this.props.graph.rulerLabel}
|
|
111
112
|
rulerTicks={this.props.graph.rulerTicks}
|
|
112
113
|
showTooltips={this.props.graph.showTooltips}
|
|
113
|
-
// @ts-expect-error
|
|
114
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
114
115
|
onChange={this.change("graph")}
|
|
115
116
|
/>
|
|
116
117
|
<div className="perseus-widget-row">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
1
2
|
/* eslint-disable react/forbid-prop-types, react/sort-comp */
|
|
2
3
|
import {ApiOptions, Changeable} from "@khanacademy/perseus";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -57,7 +58,7 @@ class GroupEditor extends React.Component<Props> {
|
|
|
57
58
|
return (
|
|
58
59
|
<GroupMetadataEditor
|
|
59
60
|
value={this.props.metadata}
|
|
60
|
-
// @ts-expect-error
|
|
61
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
61
62
|
onChange={this.change("metadata")}
|
|
62
63
|
/>
|
|
63
64
|
);
|
|
@@ -69,13 +70,13 @@ class GroupEditor extends React.Component<Props> {
|
|
|
69
70
|
|
|
70
71
|
getSaveWarnings: () => ReadonlyArray<any> = () => {
|
|
71
72
|
// eslint-disable-next-line react/no-string-refs
|
|
72
|
-
// @ts-expect-error
|
|
73
|
+
// @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
|
|
73
74
|
return this.refs.editor.getSaveWarnings();
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
serialize: () => any = () => {
|
|
77
78
|
// eslint-disable-next-line react/no-string-refs
|
|
78
|
-
// @ts-expect-error
|
|
79
|
+
// @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
|
|
79
80
|
return _.extend({}, this.refs.editor.serialize(), {
|
|
80
81
|
metadata: this.props.metadata,
|
|
81
82
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
1
2
|
/* eslint-disable react/sort-comp */
|
|
2
3
|
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -143,7 +144,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
|
|
|
143
144
|
Url or Program ID:
|
|
144
145
|
<BlurInput
|
|
145
146
|
value={this.props.url}
|
|
146
|
-
// @ts-expect-error
|
|
147
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
147
148
|
onChange={this.change("url")}
|
|
148
149
|
/>
|
|
149
150
|
</label>
|
|
@@ -161,7 +162,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
|
|
|
161
162
|
Width:
|
|
162
163
|
<BlurInput
|
|
163
164
|
value={this.props.width}
|
|
164
|
-
// @ts-expect-error
|
|
165
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
165
166
|
onChange={this.change("width")}
|
|
166
167
|
/>
|
|
167
168
|
</label>
|
|
@@ -169,7 +170,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
|
|
|
169
170
|
Height:
|
|
170
171
|
<BlurInput
|
|
171
172
|
value={this.props.height}
|
|
172
|
-
// @ts-expect-error
|
|
173
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
173
174
|
onChange={this.change("height")}
|
|
174
175
|
/>
|
|
175
176
|
</label>
|
|
@@ -189,7 +190,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
handleSettingsChange: (arg1: any) => void = (settings) => {
|
|
192
|
-
// @ts-expect-error
|
|
193
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
193
194
|
this.change({settings: settings.pairs});
|
|
194
195
|
};
|
|
195
196
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable react/sort-comp */
|
|
2
|
-
import {components, Util
|
|
2
|
+
import {components, Util} from "@khanacademy/perseus";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import ReactDOM from "react-dom";
|
|
5
5
|
import _ from "underscore";
|
|
6
6
|
|
|
7
7
|
import BlurInput from "../components/blur-input";
|
|
8
8
|
|
|
9
|
-
import type {ParsedValue} from "@khanacademy/perseus";
|
|
9
|
+
import type {ParsedValue, InputNumber} from "@khanacademy/perseus";
|
|
10
10
|
|
|
11
11
|
const {InfoTip} = components;
|
|
12
12
|
|
|
@@ -144,7 +144,7 @@ class InputNumberEditor extends React.Component<Props> {
|
|
|
144
144
|
value={this.props.simplify}
|
|
145
145
|
onChange={(e) => {
|
|
146
146
|
this.props.onChange({
|
|
147
|
-
// @ts-expect-error
|
|
147
|
+
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"optional" | "required" | "enforced" | undefined'.
|
|
148
148
|
simplify: e.target.value,
|
|
149
149
|
});
|
|
150
150
|
}}
|
|
@@ -218,7 +218,7 @@ class InputNumberEditor extends React.Component<Props> {
|
|
|
218
218
|
<select
|
|
219
219
|
value={this.props.answerType}
|
|
220
220
|
onChange={(e) => {
|
|
221
|
-
// @ts-expect-error
|
|
221
|
+
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"number" | "integer" | "mixed" | "decimal" | "improper" | "percent" | "pi" | "rational" | undefined'.
|
|
222
222
|
this.props.onChange({answerType: e.target.value});
|
|
223
223
|
}}
|
|
224
224
|
>
|
|
@@ -239,7 +239,7 @@ class InputNumberEditor extends React.Component<Props> {
|
|
|
239
239
|
<select
|
|
240
240
|
value={this.props.size}
|
|
241
241
|
onChange={(e) => {
|
|
242
|
-
// @ts-expect-error
|
|
242
|
+
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"small" | "normal" | undefined'.
|
|
243
243
|
this.props.onChange({size: e.target.value});
|
|
244
244
|
}}
|
|
245
245
|
>
|
|
@@ -275,7 +275,7 @@ class InputNumberEditor extends React.Component<Props> {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
focus: () => boolean = () => {
|
|
278
|
-
// @ts-expect-error
|
|
278
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
279
279
|
ReactDOM.findDOMNode(this.refs.input).focus(); // eslint-disable-line react/no-string-refs
|
|
280
280
|
return true;
|
|
281
281
|
};
|