@khanacademy/perseus-editor 1.1.1 → 2.0.0
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/.babelrc.js +1 -1
- package/.eslintrc.js +1 -0
- package/CHANGELOG.md +14 -0
- package/dist/all-editors.d.ts +2 -0
- package/dist/all-editors.js.flow +8 -0
- package/dist/all-widgets.d.ts +22 -0
- package/dist/all-widgets.js.flow +34 -0
- package/dist/article-editor.d.ts +59 -0
- package/dist/article-editor.js.flow +72 -0
- package/dist/components/blur-input.d.ts +19 -0
- package/dist/components/blur-input.js.flow +25 -0
- package/dist/components/checkbox.d.ts +20 -0
- package/dist/components/checkbox.js.flow +26 -0
- package/dist/components/device-framer.d.ts +15 -0
- package/dist/components/device-framer.js.flow +20 -0
- package/dist/components/drag-target.d.ts +2 -0
- package/dist/components/drag-target.js.flow +8 -0
- package/dist/components/dropdown-option.d.ts +35 -0
- package/dist/components/dropdown-option.js.flow +49 -0
- package/dist/components/form-wrapped-text-field.d.ts +48 -0
- package/dist/components/form-wrapped-text-field.js.flow +48 -0
- package/dist/components/graph-settings.d.ts +2 -0
- package/dist/components/graph-settings.js.flow +8 -0
- package/dist/components/hover-behavior.d.ts +85 -0
- package/dist/components/hover-behavior.js.flow +48 -0
- package/dist/components/json-editor.d.ts +2 -0
- package/dist/components/json-editor.js.flow +8 -0
- package/dist/components/link.d.ts +41 -0
- package/dist/components/link.js.flow +50 -0
- package/dist/components/simple-button.d.ts +16 -0
- package/dist/components/simple-button.js.flow +18 -0
- package/dist/components/sortable.d.ts +2 -0
- package/dist/components/sortable.js.flow +8 -0
- package/dist/components/util.d.ts +1 -0
- package/dist/components/util.js.flow +9 -0
- package/dist/components/viewport-resizer.d.ts +16 -0
- package/dist/components/viewport-resizer.js.flow +22 -0
- package/dist/diffs/__stories__/perseus-diff-wrapper.d.ts +5 -0
- package/dist/diffs/__stories__/perseus-diff-wrapper.js.flow +11 -0
- package/dist/diffs/article-diff.d.ts +50 -0
- package/dist/diffs/article-diff.js.flow +71 -0
- package/dist/diffs/item-diff.d.ts +23 -0
- package/dist/diffs/item-diff.js.flow +41 -0
- package/dist/diffs/renderer-diff.d.ts +22 -0
- package/dist/diffs/renderer-diff.js.flow +25 -0
- package/dist/diffs/split-diff.d.ts +2 -0
- package/dist/diffs/split-diff.js.flow +8 -0
- package/dist/diffs/string-array-diff.d.ts +2 -0
- package/dist/diffs/string-array-diff.js.flow +11 -0
- package/dist/diffs/structured-item-diff.d.ts +25 -0
- package/dist/diffs/structured-item-diff.js.flow +37 -0
- package/dist/diffs/tags-diff.d.ts +21 -0
- package/dist/diffs/tags-diff.js.flow +24 -0
- package/dist/diffs/text-diff.d.ts +15 -0
- package/dist/diffs/text-diff.js.flow +21 -0
- package/dist/diffs/widget-diff-performer.d.ts +2 -0
- package/dist/diffs/widget-diff-performer.js.flow +8 -0
- package/dist/diffs/widget-diff.d.ts +21 -0
- package/dist/diffs/widget-diff.js.flow +31 -0
- package/dist/editor-page.d.ts +57 -0
- package/dist/editor-page.js.flow +73 -0
- package/dist/editor.d.ts +82 -0
- package/dist/editor.js.flow +98 -0
- package/dist/es/index.js +1428 -2587
- package/dist/es/index.js.map +1 -1
- package/dist/hint-editor.d.ts +64 -0
- package/dist/hint-editor.js.flow +87 -0
- package/dist/i18n.d.ts +7 -0
- package/dist/i18n.js.flow +13 -0
- package/dist/iframe-content-renderer.d.ts +22 -0
- package/dist/iframe-content-renderer.js.flow +28 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1492 -2548
- package/dist/index.js.flow +23 -2
- package/dist/index.js.map +1 -1
- package/dist/item-editor.d.ts +36 -0
- package/dist/item-editor.js.flow +46 -0
- package/dist/item-extras-editor.d.ts +17 -0
- package/dist/item-extras-editor.js.flow +23 -0
- package/dist/katex-error-view.d.ts +16 -0
- package/dist/katex-error-view.js.flow +24 -0
- package/dist/multirenderer-editor.d.ts +32 -0
- package/dist/multirenderer-editor.js.flow +46 -0
- package/dist/section-control-button.d.ts +12 -0
- package/dist/section-control-button.js.flow +20 -0
- package/dist/stateful-article-editor.d.ts +10 -0
- package/dist/stateful-article-editor.js.flow +16 -0
- package/dist/stateful-editor-page.d.ts +2 -0
- package/dist/stateful-editor-page.js.flow +8 -0
- package/dist/testing-widgets.d.ts +22 -0
- package/dist/testing-widgets.js.flow +34 -0
- package/dist/util/register-all-widgets-and-editors-for-testing.d.ts +1 -0
- package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +7 -0
- package/dist/widgets/categorizer-editor.d.ts +47 -0
- package/dist/widgets/categorizer-editor.js.flow +61 -0
- package/dist/widgets/cs-program-editor.d.ts +21 -0
- package/dist/widgets/cs-program-editor.js.flow +25 -0
- package/dist/widgets/definition-editor.d.ts +17 -0
- package/dist/widgets/definition-editor.js.flow +23 -0
- package/dist/widgets/dropdown-editor.d.ts +23 -0
- package/dist/widgets/dropdown-editor.js.flow +37 -0
- package/dist/widgets/example-graphie-widget-editor.d.ts +18 -0
- package/dist/widgets/example-graphie-widget-editor.js.flow +25 -0
- package/dist/widgets/example-graphie-widget.d.ts +87 -0
- package/dist/widgets/example-graphie-widget.js.flow +101 -0
- package/dist/widgets/example-widget-editor.d.ts +19 -0
- package/dist/widgets/example-widget-editor.js.flow +26 -0
- package/dist/widgets/example-widget.d.ts +71 -0
- package/dist/widgets/example-widget.js.flow +86 -0
- package/dist/widgets/explanation-editor.d.ts +21 -0
- package/dist/widgets/explanation-editor.js.flow +27 -0
- package/dist/widgets/expression-editor.d.ts +33 -0
- package/dist/widgets/expression-editor.js.flow +41 -0
- package/dist/widgets/graded-group-editor.d.ts +53 -0
- package/dist/widgets/graded-group-editor.js.flow +67 -0
- package/dist/widgets/graded-group-set-editor.d.ts +51 -0
- package/dist/widgets/graded-group-set-editor.js.flow +65 -0
- package/dist/widgets/grapher-editor.d.ts +14 -0
- package/dist/widgets/grapher-editor.js.flow +21 -0
- package/dist/widgets/group-editor.d.ts +49 -0
- package/dist/widgets/group-editor.js.flow +63 -0
- package/dist/widgets/iframe-editor.d.ts +18 -0
- package/dist/widgets/iframe-editor.js.flow +24 -0
- package/dist/widgets/image-editor.d.ts +2 -0
- package/dist/widgets/image-editor.js.flow +8 -0
- package/dist/widgets/input-number-editor.d.ts +47 -0
- package/dist/widgets/input-number-editor.js.flow +77 -0
- package/dist/widgets/interaction/constraint-editor.d.ts +26 -0
- package/dist/widgets/interaction/constraint-editor.js.flow +35 -0
- package/dist/widgets/interaction-editor.d.ts +28 -0
- package/dist/widgets/interaction-editor.js.flow +36 -0
- package/dist/widgets/interactive-graph-editor.d.ts +2 -0
- package/dist/widgets/interactive-graph-editor.js.flow +8 -0
- package/dist/widgets/label-image/answer-choices.d.ts +13 -0
- package/dist/widgets/label-image/answer-choices.js.flow +16 -0
- package/dist/widgets/label-image/behavior.d.ts +14 -0
- package/dist/widgets/label-image/behavior.js.flow +17 -0
- package/dist/widgets/label-image/marker.d.ts +30 -0
- package/dist/widgets/label-image/marker.js.flow +34 -0
- package/dist/widgets/label-image/question-markers.d.ts +22 -0
- package/dist/widgets/label-image/question-markers.js.flow +25 -0
- package/dist/widgets/label-image/select-image.d.ts +10 -0
- package/dist/widgets/label-image/select-image.js.flow +13 -0
- package/dist/widgets/label-image-editor.d.ts +45 -0
- package/dist/widgets/label-image-editor.js.flow +44 -0
- package/dist/widgets/lights-puzzle-editor.d.ts +24 -0
- package/dist/widgets/lights-puzzle-editor.js.flow +34 -0
- package/dist/widgets/matcher-editor.d.ts +19 -0
- package/dist/widgets/matcher-editor.js.flow +28 -0
- package/dist/widgets/matrix-editor.d.ts +20 -0
- package/dist/widgets/matrix-editor.js.flow +26 -0
- package/dist/widgets/measurer-editor.d.ts +32 -0
- package/dist/widgets/measurer-editor.js.flow +42 -0
- package/dist/widgets/molecule-editor.d.ts +17 -0
- package/dist/widgets/molecule-editor.js.flow +23 -0
- package/dist/widgets/number-line-editor.d.ts +36 -0
- package/dist/widgets/number-line-editor.js.flow +45 -0
- package/dist/widgets/numeric-input-editor.d.ts +2 -0
- package/dist/widgets/numeric-input-editor.js.flow +8 -0
- package/dist/widgets/orderer-editor.d.ts +20 -0
- package/dist/widgets/orderer-editor.js.flow +30 -0
- package/dist/widgets/passage-editor.d.ts +18 -0
- package/dist/widgets/passage-editor.js.flow +24 -0
- package/dist/widgets/passage-ref-editor.d.ts +11 -0
- package/dist/widgets/passage-ref-editor.js.flow +17 -0
- package/dist/widgets/passage-ref-target-editor.d.ts +16 -0
- package/dist/widgets/passage-ref-target-editor.js.flow +22 -0
- package/dist/widgets/plotter-editor.d.ts +45 -0
- package/dist/widgets/plotter-editor.js.flow +53 -0
- package/dist/widgets/radio/editor.d.ts +64 -0
- package/dist/widgets/radio/editor.js.flow +80 -0
- package/dist/widgets/reaction-diagram-editor.d.ts +20 -0
- package/dist/widgets/reaction-diagram-editor.js.flow +26 -0
- package/dist/widgets/sequence-editor.d.ts +56 -0
- package/dist/widgets/sequence-editor.js.flow +72 -0
- package/dist/widgets/simple-markdown-tester-editor.d.ts +14 -0
- package/dist/widgets/simple-markdown-tester-editor.js.flow +23 -0
- package/dist/widgets/simple-markdown-tester.d.ts +52 -0
- package/dist/widgets/simple-markdown-tester.js.flow +61 -0
- package/dist/widgets/simulator-editor.d.ts +20 -0
- package/dist/widgets/simulator-editor.js.flow +26 -0
- package/dist/widgets/sorter-editor.d.ts +16 -0
- package/dist/widgets/sorter-editor.js.flow +22 -0
- package/dist/widgets/table-editor.d.ts +18 -0
- package/dist/widgets/table-editor.js.flow +24 -0
- package/dist/widgets/transformer-editor.d.ts +11 -0
- package/dist/widgets/transformer-editor.js.flow +17 -0
- package/dist/widgets/unit-editor.d.ts +33 -0
- package/dist/widgets/unit-editor.js.flow +41 -0
- package/dist/widgets/video-editor.d.ts +19 -0
- package/dist/widgets/video-editor.js.flow +25 -0
- package/package.json +6 -5
- package/src/__stories__/{editor.stories.js → editor.stories.tsx} +4 -5
- package/src/__stories__/{section-control-button.stories.jsx → section-control-button.stories.tsx} +10 -11
- package/src/__testdata__/{input-number_testdata.js → input-number.testdata.ts} +2 -3
- package/src/__tests__/{editor_test.jsx → editor.test.tsx} +4 -7
- package/src/__tests__/{i18n_test.jsx → i18n.test.ts} +5 -5
- package/src/__tests__/{traversal_test.jsx → traversal.test.ts} +9 -10
- package/src/{all-editors_test.js → all-editors.test.ts} +1 -2
- package/src/all-editors.ts +83 -0
- package/src/all-widgets.ts +7 -0
- package/src/{article-editor.jsx → article-editor.tsx} +52 -42
- package/src/components/__stories__/{blur-input.stories.jsx → blur-input.stories.tsx} +2 -4
- package/src/components/{blur-input.jsx → blur-input.tsx} +12 -13
- package/src/components/{checkbox.jsx → checkbox.tsx} +18 -19
- package/src/components/{device-framer.jsx → device-framer.tsx} +4 -5
- package/src/components/{drag-target.jsx → drag-target.tsx} +0 -1
- package/src/components/{dropdown-option.jsx → dropdown-option.tsx} +40 -40
- package/src/components/{form-wrapped-text-field.jsx → form-wrapped-text-field.tsx} +47 -53
- package/src/components/{graph-settings.jsx → graph-settings.tsx} +4 -8
- package/src/components/{hover-behavior.jsx → hover-behavior.ts} +32 -33
- package/src/components/{json-editor.jsx → json-editor.tsx} +4 -3
- package/src/components/{link.jsx → link.ts} +33 -33
- package/src/components/{simple-button.jsx → simple-button.tsx} +3 -4
- package/src/components/{sortable.jsx → sortable.tsx} +3 -3
- package/src/components/{util.js → util.ts} +1 -2
- package/src/components/{viewport-resizer.jsx → viewport-resizer.tsx} +5 -6
- package/src/diffs/__stories__/{perseus-diff-wrapper.jsx → perseus-diff-wrapper.tsx} +3 -2
- package/src/diffs/__stories__/{structured-item-diff.stories.jsx → structured-item-diff.stories.tsx} +27 -22
- package/src/diffs/__stories__/{tags-diff.stories.jsx → tags-diff.stories.tsx} +12 -14
- package/src/diffs/__stories__/{text-diff.stories.jsx → text-diff.stories.tsx} +12 -14
- package/src/diffs/__tests__/{split-diff_test.js → split-diff.test.ts} +1 -2
- package/src/diffs/__tests__/{string-array-diff_test.js → string-array-diff.test.ts} +1 -2
- package/src/diffs/__tests__/{structured-item-diff_test.js → structured-item-diff.test.ts} +15 -14
- package/src/diffs/__tests__/{widget-diff-performer_test.js → widget-diff-performer.test.ts} +1 -2
- package/src/diffs/{article-diff.jsx → article-diff.tsx} +5 -6
- package/src/diffs/{item-diff.jsx → item-diff.tsx} +4 -5
- package/src/diffs/{renderer-diff.jsx → renderer-diff.tsx} +22 -28
- package/src/diffs/{split-diff.jsx → split-diff.ts} +4 -3
- package/src/diffs/{string-array-diff.jsx → string-array-diff.ts} +8 -9
- package/src/diffs/{structured-item-diff.jsx → structured-item-diff.tsx} +32 -27
- package/src/diffs/{tags-diff.jsx → tags-diff.tsx} +15 -16
- package/src/diffs/{text-diff.jsx → text-diff.tsx} +13 -13
- package/src/diffs/{widget-diff-performer.jsx → widget-diff-performer.ts} +3 -8
- package/src/diffs/{widget-diff.jsx → widget-diff.tsx} +15 -14
- package/src/{editor-page.jsx → editor-page.tsx} +52 -60
- package/src/{editor.jsx → editor.tsx} +315 -277
- package/src/{hint-editor.jsx → hint-editor.tsx} +105 -79
- package/src/{i18n.jsx → i18n.ts} +9 -6
- package/src/{iframe-content-renderer.jsx → iframe-content-renderer.tsx} +23 -17
- package/src/{index.js → index.ts} +15 -16
- package/src/{item-editor.jsx → item-editor.tsx} +35 -30
- package/src/{item-extras-editor.jsx → item-extras-editor.tsx} +3 -4
- package/src/{katex-error-view.jsx → katex-error-view.tsx} +4 -5
- package/src/{multirenderer-editor.jsx → multirenderer-editor.tsx} +132 -127
- package/src/{section-control-button.jsx → section-control-button.tsx} +10 -9
- package/src/{stateful-article-editor.jsx → stateful-article-editor.tsx} +2 -5
- package/src/{stateful-editor-page.jsx → stateful-editor-page.tsx} +1 -3
- package/src/{testing-widgets.js → testing-widgets.ts} +5 -6
- package/src/util/{register-all-widgets-and-editors-for-testing_test.js → register-all-widgets-and-editors-for-testing.test.ts} +1 -2
- package/src/util/{register-all-widgets-and-editors-for-testing.js → register-all-widgets-and-editors-for-testing.ts} +2 -3
- package/src/widgets/__stories__/{label-image-editor.stories.jsx → label-image-editor.stories.tsx} +22 -18
- package/src/widgets/__stories__/{radio-editor.stories.jsx → radio-editor.stories.tsx} +15 -10
- package/src/widgets/{categorizer-editor.jsx → categorizer-editor.tsx} +8 -6
- package/src/widgets/{cs-program-editor.jsx → cs-program-editor.tsx} +17 -17
- package/src/widgets/{definition-editor.jsx → definition-editor.tsx} +9 -8
- package/src/widgets/{dropdown-editor.jsx → dropdown-editor.tsx} +27 -19
- package/src/widgets/{example-graphie-widget-editor.jsx → example-graphie-widget-editor.tsx} +8 -8
- package/src/widgets/{example-graphie-widget.jsx → example-graphie-widget.tsx} +14 -17
- package/src/widgets/{example-widget-editor.jsx → example-widget-editor.tsx} +10 -7
- package/src/widgets/{example-widget.jsx → example-widget.tsx} +14 -12
- package/src/widgets/{explanation-editor.jsx → explanation-editor.tsx} +12 -10
- package/src/widgets/{expression-editor.jsx → expression-editor.tsx} +36 -26
- package/src/widgets/{graded-group-editor.jsx → graded-group-editor.tsx} +18 -10
- package/src/widgets/{graded-group-set-editor.jsx → graded-group-set-editor.tsx} +15 -12
- package/src/widgets/{grapher-editor.jsx → grapher-editor.tsx} +10 -9
- package/src/widgets/{group-editor.jsx → group-editor.tsx} +11 -9
- package/src/widgets/{iframe-editor.jsx → iframe-editor.tsx} +16 -13
- package/src/widgets/{image-editor.jsx → image-editor.tsx} +4 -7
- package/src/widgets/{input-number-editor.jsx → input-number-editor.tsx} +61 -47
- package/src/widgets/interaction/{constraint-editor.jsx → constraint-editor.tsx} +21 -24
- package/src/widgets/{interaction-editor.jsx → interaction-editor.tsx} +160 -61
- package/src/widgets/{interactive-graph-editor.jsx → interactive-graph-editor.tsx} +13 -10
- package/src/widgets/label-image/__stories__/{answer-choices.stories.jsx → answer-choices.stories.tsx} +22 -17
- package/src/widgets/label-image/__stories__/{behavior.stories.jsx → behavior.stories.tsx} +9 -10
- package/src/widgets/label-image/__stories__/{marker.stories.jsx → marker.stories.tsx} +11 -12
- package/src/widgets/label-image/__stories__/{question-markers.stories.jsx → question-markers.stories.tsx} +17 -16
- package/src/widgets/label-image/__stories__/{select-image.stories.jsx → select-image.stories.tsx} +12 -13
- package/src/widgets/label-image/{answer-choices.jsx → answer-choices.tsx} +18 -18
- package/src/widgets/label-image/{behavior.jsx → behavior.tsx} +9 -11
- package/src/widgets/label-image/{marker.jsx → marker.tsx} +17 -19
- package/src/widgets/label-image/{question-markers.jsx → question-markers.tsx} +16 -21
- package/src/widgets/label-image/{select-image.jsx → select-image.tsx} +5 -7
- package/src/widgets/{label-image-editor.jsx → label-image-editor.tsx} +38 -44
- package/src/widgets/{lights-puzzle-editor.jsx → lights-puzzle-editor.tsx} +34 -24
- package/src/widgets/{matcher-editor.jsx → matcher-editor.tsx} +9 -7
- package/src/widgets/{matrix-editor.jsx → matrix-editor.tsx} +10 -9
- package/src/widgets/{measurer-editor.jsx → measurer-editor.tsx} +21 -14
- package/src/widgets/{molecule-editor.jsx → molecule-editor.tsx} +9 -8
- package/src/widgets/{number-line-editor.jsx → number-line-editor.tsx} +19 -17
- package/src/widgets/{numeric-input-editor.jsx → numeric-input-editor.tsx} +10 -10
- package/src/widgets/{orderer-editor.jsx → orderer-editor.tsx} +17 -12
- package/src/widgets/{passage-editor.jsx → passage-editor.tsx} +9 -7
- package/src/widgets/{passage-ref-editor.jsx → passage-ref-editor.tsx} +8 -6
- package/src/widgets/{passage-ref-target-editor.jsx → passage-ref-target-editor.tsx} +9 -7
- package/src/widgets/{plotter-editor.jsx → plotter-editor.tsx} +34 -33
- package/src/widgets/radio/{editor.jsx → editor.tsx} +22 -21
- package/src/widgets/{reaction-diagram-editor.jsx → reaction-diagram-editor.tsx} +14 -10
- package/src/widgets/{sequence-editor.jsx → sequence-editor.tsx} +13 -13
- package/src/widgets/{simple-markdown-tester-editor.jsx → simple-markdown-tester-editor.tsx} +11 -9
- package/src/widgets/{simple-markdown-tester.jsx → simple-markdown-tester.tsx} +8 -7
- package/src/widgets/{simulator-editor.jsx → simulator-editor.tsx} +10 -8
- package/src/widgets/{sorter-editor.jsx → sorter-editor.tsx} +8 -6
- package/src/widgets/{table-editor.jsx → table-editor.tsx} +11 -10
- package/src/widgets/{transformer-editor.jsx → transformer-editor.tsx} +37 -35
- package/src/widgets/{unit-editor.jsx → unit-editor.tsx} +31 -25
- package/src/widgets/{video-editor.jsx → video-editor.tsx} +8 -9
- package/tsconfig.json +22 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/src/all-editors.js +0 -85
- package/src/all-widgets.js +0 -10
- /package/dist/{strings.js → strings} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable react/sort-comp */
|
|
2
|
-
// @flow
|
|
3
2
|
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
import * as React from "react";
|
|
@@ -11,12 +10,12 @@ const defaultImage = {
|
|
|
11
10
|
url: null,
|
|
12
11
|
top: 0,
|
|
13
12
|
left: 0,
|
|
14
|
-
};
|
|
13
|
+
} as const;
|
|
15
14
|
|
|
16
|
-
type Props =
|
|
15
|
+
type Props = any;
|
|
17
16
|
|
|
18
17
|
class MeasurerEditor extends React.Component<Props> {
|
|
19
|
-
static widgetName
|
|
18
|
+
static widgetName = "measurer" as const;
|
|
20
19
|
|
|
21
20
|
static propTypes = {
|
|
22
21
|
...Changeable.propTypes,
|
|
@@ -45,9 +44,9 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
45
44
|
rulerLength: 10,
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
className
|
|
47
|
+
className = "perseus-widget-measurer";
|
|
49
48
|
|
|
50
|
-
render(): React.
|
|
49
|
+
render(): React.ReactNode {
|
|
51
50
|
const image = _.extend({}, defaultImage, this.props.image);
|
|
52
51
|
|
|
53
52
|
return (
|
|
@@ -95,6 +94,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
95
94
|
<div>
|
|
96
95
|
Containing area [width, height]:{" "}
|
|
97
96
|
<RangeInput
|
|
97
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
98
98
|
onChange={this.change("box")}
|
|
99
99
|
value={this.props.box}
|
|
100
100
|
useArrowKeys={true}
|
|
@@ -124,6 +124,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
124
124
|
Ruler label:{" "}
|
|
125
125
|
<select
|
|
126
126
|
onChange={(e) =>
|
|
127
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
|
|
127
128
|
this.change(
|
|
128
129
|
"rulerLabel",
|
|
129
130
|
e.target.value,
|
|
@@ -157,6 +158,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
157
158
|
Ruler ticks:{" "}
|
|
158
159
|
<select
|
|
159
160
|
onChange={(e) =>
|
|
161
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
|
|
160
162
|
this.change(
|
|
161
163
|
"rulerTicks",
|
|
162
164
|
+e.target.value,
|
|
@@ -179,6 +181,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
179
181
|
Ruler pixels per unit:{" "}
|
|
180
182
|
<NumberInput
|
|
181
183
|
placeholder={40}
|
|
184
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
182
185
|
onChange={this.change("rulerPixels")}
|
|
183
186
|
value={this.props.rulerPixels}
|
|
184
187
|
useArrowKeys={true}
|
|
@@ -190,6 +193,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
190
193
|
Ruler length in units:{" "}
|
|
191
194
|
<NumberInput
|
|
192
195
|
placeholder={10}
|
|
196
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
193
197
|
onChange={this.change("rulerLength")}
|
|
194
198
|
value={this.props.rulerLength}
|
|
195
199
|
useArrowKeys={true}
|
|
@@ -202,31 +206,34 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
202
206
|
);
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
change: (
|
|
209
|
+
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
206
210
|
return Changeable.change.apply(this, args);
|
|
207
211
|
};
|
|
208
212
|
|
|
209
|
-
_changeUrl: (
|
|
213
|
+
_changeUrl: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (e) => {
|
|
210
214
|
this._changeImage("url", e.target.value);
|
|
211
215
|
};
|
|
212
216
|
|
|
213
|
-
_changeTop: (
|
|
217
|
+
_changeTop: (arg1: any) => void = (newTop) => {
|
|
214
218
|
this._changeImage("top", newTop);
|
|
215
219
|
};
|
|
216
220
|
|
|
217
|
-
_changeLeft: (
|
|
221
|
+
_changeLeft: (arg1: any) => void = (newLeft) => {
|
|
218
222
|
this._changeImage("left", newLeft);
|
|
219
223
|
};
|
|
220
224
|
|
|
221
|
-
_changeImage: (string,
|
|
225
|
+
_changeImage: (arg1: string, arg2: any) => void = (subProp, newValue) => {
|
|
222
226
|
const image = _.clone(this.props.image);
|
|
223
227
|
image[subProp] = newValue;
|
|
228
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
|
|
224
229
|
this.change("image", image);
|
|
225
230
|
};
|
|
226
231
|
|
|
227
232
|
renderLabelChoices: (
|
|
228
|
-
|
|
229
|
-
) =>
|
|
233
|
+
arg1: ReadonlyArray<[string, string]>,
|
|
234
|
+
) => ReadonlyArray<React.ReactElement<React.ComponentProps<"option">>> = (
|
|
235
|
+
choices,
|
|
236
|
+
) => {
|
|
230
237
|
return _.map(choices, function (nameAndValue) {
|
|
231
238
|
const [name, value] = nameAndValue;
|
|
232
239
|
return (
|
|
@@ -237,7 +244,7 @@ class MeasurerEditor extends React.Component<Props> {
|
|
|
237
244
|
});
|
|
238
245
|
};
|
|
239
246
|
|
|
240
|
-
serialize: () =>
|
|
247
|
+
serialize: () => any = () => {
|
|
241
248
|
return EditorJsonify.serialize.call(this);
|
|
242
249
|
};
|
|
243
250
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
|
|
6
5
|
const {NumberInput, TextInput} = components;
|
|
7
6
|
|
|
8
|
-
type Props =
|
|
7
|
+
type Props = any;
|
|
9
8
|
|
|
10
9
|
class MoleculeWidgetEditor extends React.Component<Props> {
|
|
11
10
|
static propTypes = {
|
|
@@ -14,25 +13,27 @@ class MoleculeWidgetEditor extends React.Component<Props> {
|
|
|
14
13
|
smiles: PropTypes.string,
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
static widgetName
|
|
16
|
+
static widgetName = "molecule-renderer" as const;
|
|
18
17
|
|
|
19
|
-
change: (
|
|
18
|
+
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
20
19
|
return Changeable.change.apply(this, args);
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
updateMolecule: (string) => void = (newValue) => {
|
|
22
|
+
updateMolecule: (arg1: string) => void = (newValue) => {
|
|
23
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
24
24
|
this.change({smiles: newValue});
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
updateRotation: (string) => void = (newValue) => {
|
|
27
|
+
updateRotation: (arg1: string) => void = (newValue) => {
|
|
28
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
28
29
|
this.change({rotationAngle: newValue});
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
serialize: () =>
|
|
32
|
+
serialize: () => any = () => {
|
|
32
33
|
return EditorJsonify.serialize.call(this);
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
render(): React.
|
|
36
|
+
render(): React.ReactNode {
|
|
36
37
|
return (
|
|
37
38
|
<div>
|
|
38
39
|
<div>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {number as knumber} from "@khanacademy/kmath";
|
|
3
2
|
import {components, EditorJsonify} from "@khanacademy/perseus";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
@@ -15,7 +14,7 @@ const bound = (x: number, gt: number, lt: number): number =>
|
|
|
15
14
|
|
|
16
15
|
const EN_DASH = "\u2013";
|
|
17
16
|
|
|
18
|
-
type Props =
|
|
17
|
+
type Props = any;
|
|
19
18
|
|
|
20
19
|
class NumberLineEditor extends React.Component<Props> {
|
|
21
20
|
static propTypes = {
|
|
@@ -41,7 +40,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
41
40
|
showTooltips: PropTypes.bool,
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
static widgetName
|
|
43
|
+
static widgetName = "number-line" as const;
|
|
45
44
|
|
|
46
45
|
static defaultProps: Props = {
|
|
47
46
|
range: [0, 10],
|
|
@@ -62,7 +61,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
62
61
|
showTooltips: false,
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
onRangeChange: (Range) => void = (range) => {
|
|
64
|
+
onRangeChange: (arg1: Range) => void = (range) => {
|
|
66
65
|
// Changing the range constrains the initial position, as well as the
|
|
67
66
|
// position of the answer and labels. Atm, it just marks them as
|
|
68
67
|
// invalid and prevents the number line from showing; it was annoying
|
|
@@ -71,7 +70,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
71
70
|
this.props.onChange({range: range});
|
|
72
71
|
};
|
|
73
72
|
|
|
74
|
-
onLabelRangeChange: (number, number) => void = (i, num) => {
|
|
73
|
+
onLabelRangeChange: (arg1: number, arg2: number) => void = (i, num) => {
|
|
75
74
|
let labelRange = this.props.labelRange.slice();
|
|
76
75
|
const otherNum = labelRange[1 - i];
|
|
77
76
|
|
|
@@ -87,7 +86,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
87
86
|
this.props.onChange({labelRange: labelRange});
|
|
88
87
|
};
|
|
89
88
|
|
|
90
|
-
onDivisionRangeChange: (Range) => void = (divisionRange) => {
|
|
89
|
+
onDivisionRangeChange: (arg1: Range) => void = (divisionRange) => {
|
|
91
90
|
let numDivisions = this.props.numDivisions;
|
|
92
91
|
numDivisions = bound(numDivisions, divisionRange[0], divisionRange[1]);
|
|
93
92
|
this.props.onChange({
|
|
@@ -96,16 +95,16 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
96
95
|
});
|
|
97
96
|
};
|
|
98
97
|
|
|
99
|
-
onNumChange: (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
) => {
|
|
103
|
-
const opts = {};
|
|
98
|
+
onNumChange: (
|
|
99
|
+
arg1: "correctX" | "initialX" | "snapDivisions",
|
|
100
|
+
arg2: number,
|
|
101
|
+
) => void = (key, value) => {
|
|
102
|
+
const opts: Record<string, any> = {};
|
|
104
103
|
opts[key] = value;
|
|
105
104
|
this.props.onChange(opts);
|
|
106
105
|
};
|
|
107
106
|
|
|
108
|
-
onNumDivisionsChange: (number) => void = (numDivisions) => {
|
|
107
|
+
onNumDivisionsChange: (arg1: number) => void = (numDivisions) => {
|
|
109
108
|
const divRange = this.props.divisionRange.slice();
|
|
110
109
|
|
|
111
110
|
// Don't allow a fraction for the number of divisions
|
|
@@ -130,14 +129,16 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
131
|
|
|
133
|
-
onTickStepChange: (number) => void = (tickStep) => {
|
|
132
|
+
onTickStepChange: (arg1: number) => void = (tickStep) => {
|
|
134
133
|
this.props.onChange({
|
|
135
134
|
numDivisions: null,
|
|
136
135
|
tickStep: tickStep,
|
|
137
136
|
});
|
|
138
137
|
};
|
|
139
138
|
|
|
140
|
-
onChangeRelation: (
|
|
139
|
+
onChangeRelation: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
140
|
+
e,
|
|
141
|
+
) => {
|
|
141
142
|
const value = e.target.value;
|
|
142
143
|
this.props.onChange({
|
|
143
144
|
correctRel: value,
|
|
@@ -145,17 +146,17 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
145
146
|
});
|
|
146
147
|
};
|
|
147
148
|
|
|
148
|
-
onLabelStyleChange: (
|
|
149
|
+
onLabelStyleChange: (arg1: any) => void = (labelStyle) => {
|
|
149
150
|
this.props.onChange({
|
|
150
151
|
labelStyle: labelStyle,
|
|
151
152
|
});
|
|
152
153
|
};
|
|
153
154
|
|
|
154
|
-
serialize: () =>
|
|
155
|
+
serialize: () => any = () => {
|
|
155
156
|
return EditorJsonify.serialize.call(this);
|
|
156
157
|
};
|
|
157
158
|
|
|
158
|
-
render(): React.
|
|
159
|
+
render(): React.ReactNode {
|
|
159
160
|
const range = this.props.range;
|
|
160
161
|
const labelRange = this.props.labelRange;
|
|
161
162
|
const divisionRange = this.props.divisionRange;
|
|
@@ -210,6 +211,7 @@ class NumberLineEditor extends React.Component<Props> {
|
|
|
210
211
|
Correct x{" "}
|
|
211
212
|
<select
|
|
212
213
|
value={this.props.correctRel}
|
|
214
|
+
// @ts-expect-error [FEI-5003] - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
213
215
|
onChange={this.onChangeRelation}
|
|
214
216
|
>
|
|
215
217
|
<option value="eq"> = </option>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/anchor-is-valid, react/sort-comp */
|
|
2
|
-
// @flow
|
|
3
2
|
import {
|
|
4
3
|
components,
|
|
5
4
|
icons,
|
|
@@ -11,7 +10,7 @@ import createReactClass from "create-react-class";
|
|
|
11
10
|
import * as React from "react";
|
|
12
11
|
import _ from "underscore";
|
|
13
12
|
|
|
14
|
-
import Editor from "../editor
|
|
13
|
+
import Editor from "../editor";
|
|
15
14
|
|
|
16
15
|
const {
|
|
17
16
|
ButtonGroup,
|
|
@@ -38,7 +37,7 @@ const answerFormButtons = [
|
|
|
38
37
|
{title: "Numbers with \u03C0", value: "pi", content: "\u03C0"},
|
|
39
38
|
];
|
|
40
39
|
|
|
41
|
-
const initAnswer = (status) => {
|
|
40
|
+
const initAnswer = (status: string) => {
|
|
42
41
|
return {
|
|
43
42
|
value: null,
|
|
44
43
|
status: status,
|
|
@@ -82,7 +81,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
82
81
|
render: function () {
|
|
83
82
|
const answers = this.props.answers;
|
|
84
83
|
|
|
85
|
-
const unsimplifiedAnswers = (i) => (
|
|
84
|
+
const unsimplifiedAnswers = (i: any) => (
|
|
86
85
|
<div className="perseus-widget-row">
|
|
87
86
|
<label>Unsimplified answers are</label>
|
|
88
87
|
<ButtonGroup
|
|
@@ -115,7 +114,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
115
114
|
</div>
|
|
116
115
|
);
|
|
117
116
|
|
|
118
|
-
const suggestedAnswerTypes = (i) => (
|
|
117
|
+
const suggestedAnswerTypes = (i: any) => (
|
|
119
118
|
<div>
|
|
120
119
|
<div className="perseus-widget-row">
|
|
121
120
|
<label>Choose the suggested answer formats</label>
|
|
@@ -161,7 +160,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
161
160
|
</div>
|
|
162
161
|
);
|
|
163
162
|
|
|
164
|
-
const maxError = (i) => (
|
|
163
|
+
const maxError = (i: any) => (
|
|
165
164
|
<div className="perseus-widget-row">
|
|
166
165
|
<label>
|
|
167
166
|
Max error{" "}
|
|
@@ -260,7 +259,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
260
259
|
wrong: "(address the mistake/misconception)",
|
|
261
260
|
ungraded: "(explain in detail to avoid confusion)",
|
|
262
261
|
correct: "(reinforce the user's understanding)",
|
|
263
|
-
};
|
|
262
|
+
} as const;
|
|
264
263
|
|
|
265
264
|
const generateInputAnswerEditors = () =>
|
|
266
265
|
answers.map((answer, i) => {
|
|
@@ -443,7 +442,6 @@ const NumericInputEditor: any = createReactClass({
|
|
|
443
442
|
},
|
|
444
443
|
|
|
445
444
|
change(...args) {
|
|
446
|
-
// $FlowFixMe[object-this-reference]
|
|
447
445
|
return Changeable.change.apply(this, args);
|
|
448
446
|
},
|
|
449
447
|
|
|
@@ -464,6 +462,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
464
462
|
onSpace: function (e, callback) {
|
|
465
463
|
if (e.key === " ") {
|
|
466
464
|
e.preventDefault(); // prevent page shifting
|
|
465
|
+
// eslint-disable-next-line prefer-rest-params
|
|
467
466
|
const args = _.toArray(arguments).slice(2);
|
|
468
467
|
callback.apply(this, args);
|
|
469
468
|
}
|
|
@@ -494,7 +493,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
494
493
|
if (!_.isObject(update)) {
|
|
495
494
|
return _.partial(
|
|
496
495
|
(choiceIndex, key, value) => {
|
|
497
|
-
const update = {};
|
|
496
|
+
const update: Record<string, any> = {};
|
|
498
497
|
update[key] = value;
|
|
499
498
|
this.updateAnswer(choiceIndex, update);
|
|
500
499
|
},
|
|
@@ -529,6 +528,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
529
528
|
// TODO(emily): This doesn't actually work, because the value is either
|
|
530
529
|
// null or undefined when undefined, probably.
|
|
531
530
|
if (_.contains(_.pluck(this.props.answers, "value"), "")) {
|
|
531
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string' is not assignable to parameter of type 'never'.
|
|
532
532
|
warnings.push("One or more answers is empty");
|
|
533
533
|
}
|
|
534
534
|
this.props.answers.forEach((answer, i) => {
|
|
@@ -537,6 +537,7 @@ const NumericInputEditor: any = createReactClass({
|
|
|
537
537
|
(!answer.answerForms || answer.answerForms.length === 0);
|
|
538
538
|
if (formatError) {
|
|
539
539
|
warnings.push(
|
|
540
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string' is not assignable to parameter of type 'never'.
|
|
540
541
|
`Answer ${i + 1} is set to string format ` +
|
|
541
542
|
"matching, but no format was selected",
|
|
542
543
|
);
|
|
@@ -546,7 +547,6 @@ const NumericInputEditor: any = createReactClass({
|
|
|
546
547
|
},
|
|
547
548
|
|
|
548
549
|
serialize() {
|
|
549
|
-
// $FlowFixMe[object-this-reference]
|
|
550
550
|
return EditorJsonify.serialize.call(this);
|
|
551
551
|
},
|
|
552
552
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable one-var, react/forbid-prop-types, react/sort-comp */
|
|
2
|
-
// @flow
|
|
3
2
|
import {components} from "@khanacademy/perseus";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
import * as React from "react";
|
|
@@ -12,7 +11,7 @@ const NORMAL = "normal",
|
|
|
12
11
|
HORIZONTAL = "horizontal",
|
|
13
12
|
VERTICAL = "vertical";
|
|
14
13
|
|
|
15
|
-
type Props =
|
|
14
|
+
type Props = any;
|
|
16
15
|
|
|
17
16
|
class OrdererEditor extends React.Component<Props> {
|
|
18
17
|
static propTypes = {
|
|
@@ -23,7 +22,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
23
22
|
onChange: PropTypes.func.isRequired,
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
static widgetName
|
|
25
|
+
static widgetName = "orderer" as const;
|
|
27
26
|
|
|
28
27
|
static defaultProps: Props = {
|
|
29
28
|
correctOptions: [{content: "$x$"}],
|
|
@@ -32,7 +31,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
32
31
|
layout: HORIZONTAL,
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
render(): React.
|
|
34
|
+
render(): React.ReactNode {
|
|
36
35
|
return (
|
|
37
36
|
<div className="perseus-widget-orderer">
|
|
38
37
|
<div>
|
|
@@ -74,6 +73,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
74
73
|
Layout:{" "}
|
|
75
74
|
<select
|
|
76
75
|
value={this.props.layout}
|
|
76
|
+
// @ts-expect-error [FEI-5003] - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
77
77
|
onChange={this.onLayoutChange}
|
|
78
78
|
>
|
|
79
79
|
<option value={HORIZONTAL}>Horizontal</option>
|
|
@@ -94,6 +94,7 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
94
94
|
Height:{" "}
|
|
95
95
|
<select
|
|
96
96
|
value={this.props.height}
|
|
97
|
+
// @ts-expect-error [FEI-5003] - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
97
98
|
onChange={this.onHeightChange}
|
|
98
99
|
>
|
|
99
100
|
<option value={NORMAL}>Normal</option>
|
|
@@ -109,26 +110,30 @@ class OrdererEditor extends React.Component<Props> {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
onOptionsChange: (
|
|
112
|
-
"correctOptions" | "otherOptions",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
) =>
|
|
116
|
-
const props = {};
|
|
113
|
+
arg1: "correctOptions" | "otherOptions",
|
|
114
|
+
arg2: any,
|
|
115
|
+
arg3: any,
|
|
116
|
+
) => any = (whichOptions, options, cb) => {
|
|
117
|
+
const props: Record<string, any> = {};
|
|
117
118
|
props[whichOptions] = _.map(options, function (option) {
|
|
118
119
|
return {content: option};
|
|
119
120
|
});
|
|
120
121
|
this.props.onChange(props, cb);
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
onLayoutChange: (
|
|
124
|
+
onLayoutChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
125
|
+
e,
|
|
126
|
+
) => {
|
|
124
127
|
this.props.onChange({layout: e.target.value});
|
|
125
128
|
};
|
|
126
129
|
|
|
127
|
-
onHeightChange: (
|
|
130
|
+
onHeightChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
131
|
+
e,
|
|
132
|
+
) => {
|
|
128
133
|
this.props.onChange({height: e.target.value});
|
|
129
134
|
};
|
|
130
135
|
|
|
131
|
-
serialize: () =>
|
|
136
|
+
serialize: () => any = () => {
|
|
132
137
|
// We combine the correct answer and the other cards by merging them,
|
|
133
138
|
// removing duplicates and empty cards, and sorting them into
|
|
134
139
|
// categories based on their content
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import _ from "underscore";
|
|
6
5
|
|
|
7
|
-
import Editor from "../editor
|
|
6
|
+
import Editor from "../editor";
|
|
8
7
|
|
|
9
8
|
const {InfoTip, PropCheckBox} = components;
|
|
10
9
|
|
|
11
|
-
type Props =
|
|
10
|
+
type Props = any;
|
|
12
11
|
|
|
13
12
|
class PassageEditor extends React.Component<Props> {
|
|
14
13
|
static propTypes = {
|
|
@@ -19,7 +18,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
19
18
|
showLineNumbers: PropTypes.bool,
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
static widgetName
|
|
21
|
+
static widgetName = "passage" as const;
|
|
23
22
|
|
|
24
23
|
static defaultProps: Props = {
|
|
25
24
|
passageTitle: "",
|
|
@@ -28,15 +27,15 @@ class PassageEditor extends React.Component<Props> {
|
|
|
28
27
|
showLineNumbers: true,
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
change: (
|
|
30
|
+
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
32
31
|
return Changeable.change.apply(this, args);
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
serialize: () =>
|
|
34
|
+
serialize: () => any = () => {
|
|
36
35
|
return EditorJsonify.serialize.call(this);
|
|
37
36
|
};
|
|
38
37
|
|
|
39
|
-
render(): React.
|
|
38
|
+
render(): React.ReactNode {
|
|
40
39
|
const passageEditor = (
|
|
41
40
|
<Editor
|
|
42
41
|
// eslint-disable-next-line react/no-string-refs
|
|
@@ -46,6 +45,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
46
45
|
widgetEnabled={false}
|
|
47
46
|
placeholder="Type passage here..."
|
|
48
47
|
onChange={(newProps) => {
|
|
48
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
49
49
|
this.change({passageText: newProps.content});
|
|
50
50
|
}}
|
|
51
51
|
showWordCount={true}
|
|
@@ -60,6 +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 [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
63
64
|
this.change({footnotes: newProps.content});
|
|
64
65
|
}}
|
|
65
66
|
/>
|
|
@@ -87,6 +88,7 @@ class PassageEditor extends React.Component<Props> {
|
|
|
87
88
|
type="text"
|
|
88
89
|
defaultValue={this.props.passageTitle}
|
|
89
90
|
onChange={(e) => {
|
|
91
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
90
92
|
this.change({passageTitle: e.target.value});
|
|
91
93
|
}}
|
|
92
94
|
/>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
|
|
6
5
|
const {InfoTip, NumberInput, TextInput} = components;
|
|
7
6
|
|
|
8
|
-
type Props =
|
|
7
|
+
type Props = any;
|
|
9
8
|
|
|
10
9
|
class PassageRefEditor extends React.Component<Props> {
|
|
11
10
|
static propTypes: Props = {
|
|
@@ -15,7 +14,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
15
14
|
summaryText: PropTypes.string,
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
static widgetName
|
|
17
|
+
static widgetName = "passage-ref" as const;
|
|
19
18
|
|
|
20
19
|
static defaultProps: Props = {
|
|
21
20
|
passageNumber: 1,
|
|
@@ -23,15 +22,15 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
23
22
|
summaryText: "",
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
change: (
|
|
25
|
+
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
27
26
|
return Changeable.change.apply(this, args);
|
|
28
27
|
};
|
|
29
28
|
|
|
30
|
-
serialize: () =>
|
|
29
|
+
serialize: () => any = () => {
|
|
31
30
|
return EditorJsonify.serialize.call(this);
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
render(): React.
|
|
33
|
+
render(): React.ReactNode {
|
|
35
34
|
return (
|
|
36
35
|
<div>
|
|
37
36
|
<div>
|
|
@@ -39,6 +38,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
39
38
|
{"Passage Number: "}
|
|
40
39
|
<NumberInput
|
|
41
40
|
value={this.props.passageNumber}
|
|
41
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
42
42
|
onChange={this.change("passageNumber")}
|
|
43
43
|
/>
|
|
44
44
|
</label>
|
|
@@ -48,6 +48,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
48
48
|
{"Reference Number: "}
|
|
49
49
|
<NumberInput
|
|
50
50
|
value={this.props.referenceNumber}
|
|
51
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
51
52
|
onChange={this.change("referenceNumber")}
|
|
52
53
|
/>
|
|
53
54
|
</label>
|
|
@@ -57,6 +58,7 @@ class PassageRefEditor extends React.Component<Props> {
|
|
|
57
58
|
{"Summary Text: "}
|
|
58
59
|
<TextInput
|
|
59
60
|
value={this.props.summaryText}
|
|
61
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
60
62
|
onChange={this.change("summaryText")}
|
|
61
63
|
/>
|
|
62
64
|
<InfoTip>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import _ from "underscore";
|
|
6
5
|
|
|
7
|
-
type Props =
|
|
6
|
+
type Props = any;
|
|
8
7
|
|
|
9
8
|
class PassageRefTargetEditor extends React.Component<Props> {
|
|
10
9
|
static propTypes = {
|
|
@@ -12,25 +11,28 @@ class PassageRefTargetEditor extends React.Component<Props> {
|
|
|
12
11
|
content: PropTypes.string,
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
static widgetName
|
|
14
|
+
static widgetName = "passage-ref-target" as const;
|
|
16
15
|
|
|
17
16
|
static defaultProps: Props = {
|
|
18
17
|
content: "",
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
change: (
|
|
20
|
+
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
22
21
|
return Changeable.change.apply(this, args);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
handleContentChange: (
|
|
24
|
+
handleContentChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
25
|
+
e,
|
|
26
|
+
) => {
|
|
27
|
+
// @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
|
|
26
28
|
this.change({content: e.target.value});
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
serialize: () =>
|
|
31
|
+
serialize: () => any = () => {
|
|
30
32
|
return EditorJsonify.serialize.call(this);
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
render(): React.
|
|
35
|
+
render(): React.ReactNode {
|
|
34
36
|
return (
|
|
35
37
|
<div>
|
|
36
38
|
Content:
|