@khanacademy/perseus-editor 4.1.5 → 4.1.7
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/dist/es/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +9 -6
- package/.babelrc.js +0 -8
- package/.eslintrc.js +0 -12
- package/CHANGELOG.md +0 -1155
- package/src/README.md +0 -7
- package/src/__stories__/editor-page.stories.tsx +0 -65
- package/src/__stories__/editor.stories.tsx +0 -134
- package/src/__stories__/item-editor.stories.tsx +0 -41
- package/src/__stories__/tex-error-view.stories.tsx +0 -26
- package/src/__testdata__/input-number.testdata.ts +0 -27
- package/src/__tests__/editor.test.tsx +0 -142
- package/src/__tests__/hint-editor.test.tsx +0 -83
- package/src/__tests__/i18n.test.ts +0 -501
- package/src/__tests__/integration.test.ts +0 -5
- package/src/__tests__/item-extras-editor.test.tsx +0 -85
- package/src/__tests__/traversal.test.ts +0 -377
- package/src/all-editors.test.ts +0 -16
- package/src/all-editors.ts +0 -83
- package/src/all-widgets.ts +0 -7
- package/src/article-editor.tsx +0 -438
- package/src/components/__stories__/blur-input.stories.tsx +0 -22
- package/src/components/__stories__/section-control-button.stories.tsx +0 -26
- package/src/components/__tests__/blur-input.test.tsx +0 -67
- package/src/components/blur-input.tsx +0 -69
- package/src/components/checkbox.tsx +0 -194
- package/src/components/device-framer.tsx +0 -90
- package/src/components/drag-target.tsx +0 -87
- package/src/components/dropdown-option.tsx +0 -311
- package/src/components/form-wrapped-text-field.tsx +0 -245
- package/src/components/graph-points-count-selector.tsx +0 -31
- package/src/components/graph-settings.tsx +0 -627
- package/src/components/graph-type-selector.tsx +0 -31
- package/src/components/hover-behavior.ts +0 -177
- package/src/components/json-editor.tsx +0 -121
- package/src/components/link.ts +0 -173
- package/src/components/section-control-button.tsx +0 -53
- package/src/components/segment-count-selector.tsx +0 -27
- package/src/components/simple-button.tsx +0 -85
- package/src/components/sortable.tsx +0 -187
- package/src/components/util.ts +0 -38
- package/src/components/viewport-resizer.tsx +0 -72
- package/src/components/widget-editor.tsx +0 -222
- package/src/components/widget-select.tsx +0 -48
- package/src/diffs/__stories__/perseus-diff-wrapper.tsx +0 -11
- package/src/diffs/__stories__/structured-item-diff.stories.tsx +0 -855
- package/src/diffs/__stories__/tags-diff.stories.tsx +0 -36
- package/src/diffs/__stories__/text-diff.stories.tsx +0 -35
- package/src/diffs/__tests__/split-diff.test.ts +0 -33
- package/src/diffs/__tests__/string-array-diff.test.ts +0 -73
- package/src/diffs/__tests__/structured-item-diff.test.ts +0 -433
- package/src/diffs/__tests__/widget-diff-performer.test.ts +0 -43
- package/src/diffs/article-diff.tsx +0 -69
- package/src/diffs/item-diff.tsx +0 -76
- package/src/diffs/renderer-diff.tsx +0 -137
- package/src/diffs/split-diff.ts +0 -31
- package/src/diffs/string-array-diff.ts +0 -74
- package/src/diffs/structured-item-diff.tsx +0 -275
- package/src/diffs/tags-diff.tsx +0 -49
- package/src/diffs/text-diff.tsx +0 -193
- package/src/diffs/widget-diff-performer.ts +0 -69
- package/src/diffs/widget-diff.tsx +0 -290
- package/src/editor-page.tsx +0 -325
- package/src/editor.tsx +0 -1099
- package/src/hint-editor.tsx +0 -469
- package/src/i18n.ts +0 -140
- package/src/iframe-content-renderer.tsx +0 -188
- package/src/index.ts +0 -30
- package/src/item-editor.tsx +0 -158
- package/src/item-extras-editor.tsx +0 -230
- package/src/katex-mhchem/index.js +0 -73
- package/src/katex-mhchem/parser.js +0 -2659
- package/src/multirenderer-editor.tsx +0 -1061
- package/src/stateful-article-editor.tsx +0 -173
- package/src/stateful-editor-page.tsx +0 -88
- package/src/styles/perseus-editor.less +0 -1321
- package/src/testing-widgets.ts +0 -11
- package/src/tex-error-view.tsx +0 -90
- package/src/util/points.test.ts +0 -24
- package/src/util/points.ts +0 -13
- package/src/util/register-all-widgets-and-editors-for-testing.test.ts +0 -17
- package/src/util/register-all-widgets-and-editors-for-testing.ts +0 -17
- package/src/version.ts +0 -10
- package/src/widgets/__stories__/categorizer-editor.stories.tsx +0 -24
- package/src/widgets/__stories__/definition-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/dropdown-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/explanation-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/expression-editor.stories.tsx +0 -122
- package/src/widgets/__stories__/image-editor.stories.tsx +0 -72
- package/src/widgets/__stories__/input-number-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/interaction-editor.stories.tsx +0 -37
- package/src/widgets/__stories__/label-image-editor.stories.tsx +0 -99
- package/src/widgets/__stories__/matcher-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/number-line-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/numeric-input-editor.stories.tsx +0 -18
- package/src/widgets/__stories__/radio-editor.stories.tsx +0 -116
- package/src/widgets/__stories__/sorter-editor.stories.tsx +0 -18
- package/src/widgets/__tests__/categorizer-editor.test.tsx +0 -51
- package/src/widgets/__tests__/definition-editor.test.tsx +0 -41
- package/src/widgets/__tests__/dropdown-editor.test.tsx +0 -57
- package/src/widgets/__tests__/explanation-editor.test.tsx +0 -59
- package/src/widgets/__tests__/expression-editor.test.tsx +0 -403
- package/src/widgets/__tests__/input-number-editor.test.tsx +0 -128
- package/src/widgets/__tests__/matcher-editor.test.tsx +0 -47
- package/src/widgets/__tests__/number-line-editor.test.tsx +0 -144
- package/src/widgets/__tests__/numeric-input-editor.test.tsx +0 -177
- package/src/widgets/__tests__/radio-editor.test.tsx +0 -118
- package/src/widgets/__tests__/sorter-editor.test.tsx +0 -55
- package/src/widgets/categorizer-editor.tsx +0 -104
- package/src/widgets/cs-program-editor.tsx +0 -256
- package/src/widgets/definition-editor.tsx +0 -77
- package/src/widgets/deprecated-standin-editor.tsx +0 -29
- package/src/widgets/dropdown-editor.tsx +0 -211
- package/src/widgets/example-graphie-widget-editor.tsx +0 -70
- package/src/widgets/example-graphie-widget.tsx +0 -172
- package/src/widgets/example-widget-editor.tsx +0 -62
- package/src/widgets/example-widget.tsx +0 -154
- package/src/widgets/explanation-editor.tsx +0 -92
- package/src/widgets/expression-editor.tsx +0 -557
- package/src/widgets/graded-group-editor.tsx +0 -161
- package/src/widgets/graded-group-set-editor.tsx +0 -104
- package/src/widgets/grapher-editor.tsx +0 -155
- package/src/widgets/group-editor.tsx +0 -83
- package/src/widgets/iframe-editor.tsx +0 -202
- package/src/widgets/image-editor.tsx +0 -367
- package/src/widgets/input-number-editor.tsx +0 -288
- package/src/widgets/interaction-editor/constraint-editor.tsx +0 -134
- package/src/widgets/interaction-editor/function-editor.tsx +0 -108
- package/src/widgets/interaction-editor/index.ts +0 -3
- package/src/widgets/interaction-editor/interaction-editor.tsx +0 -749
- package/src/widgets/interaction-editor/label-editor.tsx +0 -87
- package/src/widgets/interaction-editor/line-editor.tsx +0 -125
- package/src/widgets/interaction-editor/mathquill-input.tsx +0 -81
- package/src/widgets/interaction-editor/movable-line-editor.tsx +0 -121
- package/src/widgets/interaction-editor/movable-point-editor.tsx +0 -89
- package/src/widgets/interaction-editor/parametric-editor.tsx +0 -117
- package/src/widgets/interaction-editor/point-editor.tsx +0 -72
- package/src/widgets/interaction-editor/rectangle-editor.tsx +0 -96
- package/src/widgets/interactive-graph-editor.tsx +0 -571
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +0 -82
- package/src/widgets/label-image/__stories__/behavior.stories.tsx +0 -31
- package/src/widgets/label-image/__stories__/marker.stories.tsx +0 -75
- package/src/widgets/label-image/__stories__/question-markers.stories.tsx +0 -107
- package/src/widgets/label-image/__stories__/select-image.stories.tsx +0 -59
- package/src/widgets/label-image/answer-choices.tsx +0 -231
- package/src/widgets/label-image/behavior.tsx +0 -122
- package/src/widgets/label-image/marker.tsx +0 -290
- package/src/widgets/label-image/question-markers.tsx +0 -176
- package/src/widgets/label-image/select-image.tsx +0 -81
- package/src/widgets/label-image-editor.tsx +0 -252
- package/src/widgets/lights-puzzle-editor.tsx +0 -278
- package/src/widgets/matcher-editor.tsx +0 -149
- package/src/widgets/matrix-editor.tsx +0 -156
- package/src/widgets/measurer-editor.tsx +0 -253
- package/src/widgets/molecule-editor.tsx +0 -64
- package/src/widgets/number-line-editor.tsx +0 -512
- package/src/widgets/numeric-input-editor.tsx +0 -536
- package/src/widgets/orderer-editor.tsx +0 -172
- package/src/widgets/passage-editor.tsx +0 -117
- package/src/widgets/passage-ref-editor.tsx +0 -80
- package/src/widgets/passage-ref-target-editor.tsx +0 -49
- package/src/widgets/plotter-editor.tsx +0 -542
- package/src/widgets/radio/editor.tsx +0 -398
- package/src/widgets/reaction-diagram-editor.tsx +0 -131
- package/src/widgets/sequence-editor.tsx +0 -205
- package/src/widgets/simple-markdown-tester-editor.tsx +0 -86
- package/src/widgets/simple-markdown-tester.tsx +0 -92
- package/src/widgets/simulator-editor.tsx +0 -146
- package/src/widgets/sorter-editor.tsx +0 -103
- package/src/widgets/table-editor.tsx +0 -164
- package/src/widgets/unit-editor.tsx +0 -299
- package/src/widgets/video-editor.tsx +0 -73
- package/tsconfig-build.json +0 -22
- package/tsconfig-build.tsbuildinfo +0 -1
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
2
|
-
/* eslint-disable one-var, react/forbid-prop-types, react/sort-comp */
|
|
3
|
-
import {components} from "@khanacademy/perseus";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import _ from "underscore";
|
|
7
|
-
|
|
8
|
-
const {InfoTip, TextListEditor} = components;
|
|
9
|
-
|
|
10
|
-
const NORMAL = "normal",
|
|
11
|
-
AUTO = "auto",
|
|
12
|
-
HORIZONTAL = "horizontal",
|
|
13
|
-
VERTICAL = "vertical";
|
|
14
|
-
|
|
15
|
-
type Props = any;
|
|
16
|
-
|
|
17
|
-
class OrdererEditor extends React.Component<Props> {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
correctOptions: PropTypes.array,
|
|
20
|
-
otherOptions: PropTypes.array,
|
|
21
|
-
height: PropTypes.oneOf([NORMAL, AUTO]),
|
|
22
|
-
layout: PropTypes.oneOf([HORIZONTAL, VERTICAL]),
|
|
23
|
-
onChange: PropTypes.func.isRequired,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
static widgetName = "orderer" as const;
|
|
27
|
-
|
|
28
|
-
static defaultProps: Props = {
|
|
29
|
-
correctOptions: [{content: "$x$"}],
|
|
30
|
-
otherOptions: [{content: "$y$"}],
|
|
31
|
-
height: NORMAL,
|
|
32
|
-
layout: HORIZONTAL,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
render(): React.ReactNode {
|
|
36
|
-
return (
|
|
37
|
-
<div className="perseus-widget-orderer">
|
|
38
|
-
<div>
|
|
39
|
-
{" "}
|
|
40
|
-
Correct answer:{" "}
|
|
41
|
-
<InfoTip>
|
|
42
|
-
<p>
|
|
43
|
-
Place the cards in the correct order. The same card
|
|
44
|
-
can be used more than once in the answer but will
|
|
45
|
-
only be displayed once at the top of a stack of
|
|
46
|
-
identical cards.
|
|
47
|
-
</p>
|
|
48
|
-
</InfoTip>
|
|
49
|
-
</div>
|
|
50
|
-
<TextListEditor
|
|
51
|
-
options={_.pluck(this.props.correctOptions, "content")}
|
|
52
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
53
|
-
onChange={this.onOptionsChange.bind(this, "correctOptions")}
|
|
54
|
-
layout={this.props.layout}
|
|
55
|
-
/>
|
|
56
|
-
|
|
57
|
-
<div>
|
|
58
|
-
{" "}
|
|
59
|
-
Other cards:{" "}
|
|
60
|
-
<InfoTip>
|
|
61
|
-
<p>Create cards that are not part of the answer.</p>
|
|
62
|
-
</InfoTip>
|
|
63
|
-
</div>
|
|
64
|
-
<TextListEditor
|
|
65
|
-
options={_.pluck(this.props.otherOptions, "content")}
|
|
66
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
67
|
-
onChange={this.onOptionsChange.bind(this, "otherOptions")}
|
|
68
|
-
layout={this.props.layout}
|
|
69
|
-
/>
|
|
70
|
-
|
|
71
|
-
<div>
|
|
72
|
-
<label>
|
|
73
|
-
{" "}
|
|
74
|
-
Layout:{" "}
|
|
75
|
-
<select
|
|
76
|
-
value={this.props.layout}
|
|
77
|
-
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
78
|
-
onChange={this.onLayoutChange}
|
|
79
|
-
>
|
|
80
|
-
<option value={HORIZONTAL}>Horizontal</option>
|
|
81
|
-
<option value={VERTICAL}>Vertical</option>
|
|
82
|
-
</select>
|
|
83
|
-
</label>
|
|
84
|
-
<InfoTip>
|
|
85
|
-
<p>
|
|
86
|
-
Use the horizontal layout for short text and small
|
|
87
|
-
images. The vertical layout is best for longer text
|
|
88
|
-
(e.g. proofs).
|
|
89
|
-
</p>
|
|
90
|
-
</InfoTip>
|
|
91
|
-
</div>
|
|
92
|
-
<div>
|
|
93
|
-
<label>
|
|
94
|
-
{" "}
|
|
95
|
-
Height:{" "}
|
|
96
|
-
<select
|
|
97
|
-
value={this.props.height}
|
|
98
|
-
// @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
|
|
99
|
-
onChange={this.onHeightChange}
|
|
100
|
-
>
|
|
101
|
-
<option value={NORMAL}>Normal</option>
|
|
102
|
-
<option value={AUTO}>Automatic</option>
|
|
103
|
-
</select>
|
|
104
|
-
</label>
|
|
105
|
-
<InfoTip>
|
|
106
|
-
<p>Use "Normal" for text, "Automatic" for images.</p>
|
|
107
|
-
</InfoTip>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
onOptionsChange: (
|
|
114
|
-
arg1: "correctOptions" | "otherOptions",
|
|
115
|
-
arg2: any,
|
|
116
|
-
arg3: any,
|
|
117
|
-
) => any = (whichOptions, options, cb) => {
|
|
118
|
-
const props: Record<string, any> = {};
|
|
119
|
-
props[whichOptions] = _.map(options, function (option) {
|
|
120
|
-
return {content: option};
|
|
121
|
-
});
|
|
122
|
-
this.props.onChange(props, cb);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
onLayoutChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
126
|
-
e,
|
|
127
|
-
) => {
|
|
128
|
-
this.props.onChange({layout: e.target.value});
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
onHeightChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
132
|
-
e,
|
|
133
|
-
) => {
|
|
134
|
-
this.props.onChange({height: e.target.value});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
serialize: () => any = () => {
|
|
138
|
-
// We combine the correct answer and the other cards by merging them,
|
|
139
|
-
// removing duplicates and empty cards, and sorting them into
|
|
140
|
-
// categories based on their content
|
|
141
|
-
const options = _.chain(_.pluck(this.props.correctOptions, "content"))
|
|
142
|
-
.union(_.pluck(this.props.otherOptions, "content"))
|
|
143
|
-
.uniq()
|
|
144
|
-
.reject(function (content) {
|
|
145
|
-
return content === "";
|
|
146
|
-
})
|
|
147
|
-
.sort()
|
|
148
|
-
.sortBy(function (content) {
|
|
149
|
-
if (/\d/.test(content)) {
|
|
150
|
-
return 0;
|
|
151
|
-
}
|
|
152
|
-
if (/^\$?[a-zA-Z]+\$?$/.test(content)) {
|
|
153
|
-
return 2;
|
|
154
|
-
}
|
|
155
|
-
return 1;
|
|
156
|
-
})
|
|
157
|
-
.map(function (content) {
|
|
158
|
-
return {content: content};
|
|
159
|
-
})
|
|
160
|
-
.value();
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
options: options,
|
|
164
|
-
correctOptions: this.props.correctOptions,
|
|
165
|
-
otherOptions: this.props.otherOptions,
|
|
166
|
-
height: this.props.height,
|
|
167
|
-
layout: this.props.layout,
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export default OrdererEditor;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import _ from "underscore";
|
|
5
|
-
|
|
6
|
-
import Editor from "../editor";
|
|
7
|
-
|
|
8
|
-
const {InfoTip, PropCheckBox} = components;
|
|
9
|
-
|
|
10
|
-
type Props = any;
|
|
11
|
-
|
|
12
|
-
class PassageEditor extends React.Component<Props> {
|
|
13
|
-
static propTypes = {
|
|
14
|
-
...Changeable.propTypes,
|
|
15
|
-
passageTitle: PropTypes.string,
|
|
16
|
-
passageText: PropTypes.string,
|
|
17
|
-
footnotes: PropTypes.string,
|
|
18
|
-
showLineNumbers: PropTypes.bool,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
static widgetName = "passage" as const;
|
|
22
|
-
|
|
23
|
-
static defaultProps: Props = {
|
|
24
|
-
passageTitle: "",
|
|
25
|
-
passageText: "",
|
|
26
|
-
footnotes: "",
|
|
27
|
-
showLineNumbers: true,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
31
|
-
return Changeable.change.apply(this, args);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
serialize: () => any = () => {
|
|
35
|
-
return EditorJsonify.serialize.call(this);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
render(): React.ReactNode {
|
|
39
|
-
const passageEditor = (
|
|
40
|
-
<Editor
|
|
41
|
-
// eslint-disable-next-line react/no-string-refs
|
|
42
|
-
ref="passage-editor"
|
|
43
|
-
apiOptions={this.props.apiOptions}
|
|
44
|
-
content={this.props.passageText}
|
|
45
|
-
widgetEnabled={false}
|
|
46
|
-
placeholder="Type passage here..."
|
|
47
|
-
onChange={(newProps) => {
|
|
48
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
49
|
-
this.change({passageText: newProps.content});
|
|
50
|
-
}}
|
|
51
|
-
showWordCount={true}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
const footnotesEditor = (
|
|
55
|
-
<Editor
|
|
56
|
-
// eslint-disable-next-line react/no-string-refs
|
|
57
|
-
ref="passage-footnotes-editor"
|
|
58
|
-
apiOptions={this.props.apiOptions}
|
|
59
|
-
content={this.props.footnotes}
|
|
60
|
-
widgetEnabled={false}
|
|
61
|
-
placeholder="Type footnotes here..."
|
|
62
|
-
onChange={(newProps) => {
|
|
63
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
64
|
-
this.change({footnotes: newProps.content});
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
return (
|
|
69
|
-
<div className="perseus-widget-passage-editor">
|
|
70
|
-
<div className="perseus-widget-row">
|
|
71
|
-
<PropCheckBox
|
|
72
|
-
label="Show line numbers"
|
|
73
|
-
labelAlignment="right"
|
|
74
|
-
showLineNumbers={this.props.showLineNumbers}
|
|
75
|
-
onChange={this.props.onChange}
|
|
76
|
-
/>
|
|
77
|
-
</div>
|
|
78
|
-
<div>
|
|
79
|
-
Passage title:
|
|
80
|
-
<InfoTip>
|
|
81
|
-
<p>
|
|
82
|
-
An optional title that will appear directly above
|
|
83
|
-
the passage in the same font style. (E.g. Passage 1)
|
|
84
|
-
</p>
|
|
85
|
-
</InfoTip>
|
|
86
|
-
<div>
|
|
87
|
-
<input
|
|
88
|
-
type="text"
|
|
89
|
-
defaultValue={this.props.passageTitle}
|
|
90
|
-
onChange={(e) => {
|
|
91
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
92
|
-
this.change({passageTitle: e.target.value});
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
<div>
|
|
98
|
-
Passage Text:
|
|
99
|
-
{passageEditor}
|
|
100
|
-
</div>
|
|
101
|
-
<div>
|
|
102
|
-
Footnotes:
|
|
103
|
-
<InfoTip>
|
|
104
|
-
<p>
|
|
105
|
-
To add footnotes, add ^ characters where they belong
|
|
106
|
-
in the passage. Then, add ^ in the footnotes area to
|
|
107
|
-
reference the footnotes in the passage.
|
|
108
|
-
</p>
|
|
109
|
-
</InfoTip>
|
|
110
|
-
{footnotesEditor}
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default PassageEditor;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
2
|
-
import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
const {InfoTip, NumberInput, TextInput} = components;
|
|
7
|
-
|
|
8
|
-
type Props = any;
|
|
9
|
-
|
|
10
|
-
class PassageRefEditor extends React.Component<Props> {
|
|
11
|
-
static propTypes: Props = {
|
|
12
|
-
...Changeable.propTypes,
|
|
13
|
-
passageNumber: PropTypes.number,
|
|
14
|
-
referenceNumber: PropTypes.number,
|
|
15
|
-
summaryText: PropTypes.string,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
static widgetName = "passage-ref" as const;
|
|
19
|
-
|
|
20
|
-
static defaultProps: Props = {
|
|
21
|
-
passageNumber: 1,
|
|
22
|
-
referenceNumber: 1,
|
|
23
|
-
summaryText: "",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
27
|
-
return Changeable.change.apply(this, args);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
serialize: () => any = () => {
|
|
31
|
-
return EditorJsonify.serialize.call(this);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
render(): React.ReactNode {
|
|
35
|
-
return (
|
|
36
|
-
<div>
|
|
37
|
-
<div>
|
|
38
|
-
<label>
|
|
39
|
-
{"Passage Number: "}
|
|
40
|
-
<NumberInput
|
|
41
|
-
value={this.props.passageNumber}
|
|
42
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
43
|
-
onChange={this.change("passageNumber")}
|
|
44
|
-
/>
|
|
45
|
-
</label>
|
|
46
|
-
</div>
|
|
47
|
-
<div>
|
|
48
|
-
<label>
|
|
49
|
-
{"Reference Number: "}
|
|
50
|
-
<NumberInput
|
|
51
|
-
value={this.props.referenceNumber}
|
|
52
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
53
|
-
onChange={this.change("referenceNumber")}
|
|
54
|
-
/>
|
|
55
|
-
</label>
|
|
56
|
-
</div>
|
|
57
|
-
<div>
|
|
58
|
-
<label>
|
|
59
|
-
{"Summary Text: "}
|
|
60
|
-
<TextInput
|
|
61
|
-
value={this.props.summaryText}
|
|
62
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
63
|
-
onChange={this.change("summaryText")}
|
|
64
|
-
/>
|
|
65
|
-
<InfoTip>
|
|
66
|
-
<p>
|
|
67
|
-
Short summary of the referenced section. This
|
|
68
|
-
will be included in parentheses and quotes
|
|
69
|
-
automatically.
|
|
70
|
-
</p>
|
|
71
|
-
<p>Ex: The start ... the end</p>
|
|
72
|
-
</InfoTip>
|
|
73
|
-
</label>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default PassageRefEditor;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {Changeable, EditorJsonify} from "@khanacademy/perseus";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import _ from "underscore";
|
|
5
|
-
|
|
6
|
-
type Props = any;
|
|
7
|
-
|
|
8
|
-
class PassageRefTargetEditor extends React.Component<Props> {
|
|
9
|
-
static propTypes = {
|
|
10
|
-
...Changeable.propTypes,
|
|
11
|
-
content: PropTypes.string,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
static widgetName = "passage-ref-target" as const;
|
|
15
|
-
|
|
16
|
-
static defaultProps: Props = {
|
|
17
|
-
content: "",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
|
|
21
|
-
return Changeable.change.apply(this, args);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
handleContentChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
|
|
25
|
-
e,
|
|
26
|
-
) => {
|
|
27
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
28
|
-
this.change({content: e.target.value});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
serialize: () => any = () => {
|
|
32
|
-
return EditorJsonify.serialize.call(this);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
render(): React.ReactNode {
|
|
36
|
-
return (
|
|
37
|
-
<div>
|
|
38
|
-
Content:
|
|
39
|
-
<input
|
|
40
|
-
type="text"
|
|
41
|
-
value={this.props.content}
|
|
42
|
-
onChange={this.handleContentChange}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default PassageRefTargetEditor;
|