@khanacademy/perseus-editor 2.0.1 → 2.0.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 +7 -0
- package/dist/es/index.js +9 -48
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +9 -48
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/article-editor.tsx +0 -1
- package/src/components/dropdown-option.tsx +0 -8
- package/src/diffs/text-diff.tsx +0 -1
- package/src/diffs/widget-diff.tsx +0 -2
- package/src/editor.tsx +0 -1
- package/src/multirenderer-editor.tsx +2 -20
- package/src/widgets/__stories__/label-image-editor.stories.tsx +0 -3
- package/src/widgets/__stories__/radio-editor.stories.tsx +0 -1
- package/src/widgets/categorizer-editor.tsx +0 -1
- package/src/widgets/cs-program-editor.tsx +0 -2
- package/src/widgets/expression-editor.tsx +0 -2
- package/src/widgets/grapher-editor.tsx +0 -1
- package/src/widgets/iframe-editor.tsx +0 -2
- package/src/widgets/input-number-editor.tsx +0 -1
- package/src/widgets/interaction-editor.tsx +0 -1
- package/src/widgets/interactive-graph-editor.tsx +0 -1
- package/src/widgets/label-image/marker.tsx +0 -1
- package/src/widgets/transformer-editor.tsx +0 -1
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.2",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@khanacademy/kas": "^0.3.1",
|
|
25
25
|
"@khanacademy/kmath": "^0.1.1",
|
|
26
|
-
"@khanacademy/perseus": "^4.0.
|
|
26
|
+
"@khanacademy/perseus": "^4.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@khanacademy/wonder-blocks-button": "^4.0.8",
|
package/src/article-editor.tsx
CHANGED
|
@@ -113,9 +113,6 @@ class Option extends React.Component<OptionProps> {
|
|
|
113
113
|
|
|
114
114
|
return (
|
|
115
115
|
<button
|
|
116
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
117
|
-
// "node (null) This type is incompatible with this.node (HTMLDivElement)"
|
|
118
|
-
// $FlowFixMe[incompatible-type](0.52.0->0.53.0)
|
|
119
116
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
|
|
120
117
|
ref={(node) => (this.node = node)}
|
|
121
118
|
value={value}
|
|
@@ -129,11 +126,6 @@ class Option extends React.Component<OptionProps> {
|
|
|
129
126
|
// @ts-expect-error [FEI-5003] - TS2322 - Type '(value: string) => void' is not assignable to type 'MouseEventHandler<HTMLButtonElement>'.
|
|
130
127
|
onClick={(value: string) => {
|
|
131
128
|
if (!disabled && onClick) {
|
|
132
|
-
// TODO(mdr): We found a new Flow error here when upgrading
|
|
133
|
-
// from 0.35.0 to 0.52.0: "value (unused function
|
|
134
|
-
// argument)". This comment was automatically added to
|
|
135
|
-
// this file, to suppress the error for now. Please
|
|
136
|
-
// consider fixing!
|
|
137
129
|
// @ts-expect-error [FEI-5003] - TS2554 - Expected 0 arguments, but got 1.
|
|
138
130
|
onClick(value);
|
|
139
131
|
}
|
package/src/diffs/text-diff.tsx
CHANGED
|
@@ -49,7 +49,6 @@ class ImageDiffSide extends React.Component<any> {
|
|
|
49
49
|
return (
|
|
50
50
|
<div key={index}>
|
|
51
51
|
<div className={className}>
|
|
52
|
-
{/* $FlowFixMe[prop-missing]: the alt prop is missing */}
|
|
53
52
|
{/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
|
|
54
53
|
<SvgImage
|
|
55
54
|
src={entry.value}
|
|
@@ -227,7 +227,6 @@ class ImageWidgetDiff extends React.Component<any> {
|
|
|
227
227
|
"image-removed": beforeSrc !== afterSrc,
|
|
228
228
|
})}
|
|
229
229
|
>
|
|
230
|
-
{/* $FlowFixMe[prop-missing]: the alt props is missing */}
|
|
231
230
|
{/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
|
|
232
231
|
<SvgImage src={beforeSrc} title={beforeSrc} />
|
|
233
232
|
</div>
|
|
@@ -242,7 +241,6 @@ class ImageWidgetDiff extends React.Component<any> {
|
|
|
242
241
|
"image-added": beforeSrc !== afterSrc,
|
|
243
242
|
})}
|
|
244
243
|
>
|
|
245
|
-
{/* $FlowFixMe[prop-missing]: the alt props is missing */}
|
|
246
244
|
{/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
|
|
247
245
|
<SvgImage src={afterSrc} title={afterSrc} />
|
|
248
246
|
</div>
|
package/src/editor.tsx
CHANGED
|
@@ -983,7 +983,6 @@ class Editor extends React.Component<EditorProps, EditorState> {
|
|
|
983
983
|
function () {
|
|
984
984
|
Util.textarea.moveCursor(
|
|
985
985
|
// findDOMNode can return Text but we know this is Element
|
|
986
|
-
// $FlowFixMe[incompatible-call]
|
|
987
986
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
|
|
988
987
|
textarea,
|
|
989
988
|
// We want to put the cursor after the widget
|
|
@@ -70,7 +70,7 @@ class ModeDropdown extends React.Component<ModeDropdownProps> {
|
|
|
70
70
|
_handleSelectMode = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
|
71
71
|
if (this.props.onChange) {
|
|
72
72
|
// event.target.value corresponds to the options' values below which
|
|
73
|
-
// are limited to EditorMode, but
|
|
73
|
+
// are limited to EditorMode, but TypeScript doesn't know that so we have
|
|
74
74
|
// to cast through any here.
|
|
75
75
|
const value = event.target.value as EditorMode;
|
|
76
76
|
this.props.onChange(value);
|
|
@@ -409,7 +409,7 @@ const NodeContent = (props: NodePropTypes) => {
|
|
|
409
409
|
|
|
410
410
|
// All uses of `data` have been cast through any which isn't safe. This was
|
|
411
411
|
// done to avoid introducing new logic which may have resulted in a change
|
|
412
|
-
// of behavior. Also, there doesn't appear to be a way to tell
|
|
412
|
+
// of behavior. Also, there doesn't appear to be a way to tell TypeScript the
|
|
413
413
|
// difference between and `TagsNode` and `ItemArrayNode`, see
|
|
414
414
|
// perseus-all-package/multi-items/item-types.js.
|
|
415
415
|
if (shape.type === "content") {
|
|
@@ -520,12 +520,6 @@ const withStickiness = <
|
|
|
520
520
|
|
|
521
521
|
render(): React.ReactNode {
|
|
522
522
|
return (
|
|
523
|
-
/**
|
|
524
|
-
* $FlowFixMe[incompatible-exact]
|
|
525
|
-
* TODO(somewhatabstract, JIRA-XXXX):
|
|
526
|
-
* Cannot create WrappedComponent element because inexact props
|
|
527
|
-
* [1] is incompatible with exact WithStickiness [2].
|
|
528
|
-
*/
|
|
529
523
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
|
|
530
524
|
<WrappedComponent {...this.props} sticky={this.state.sticky} />
|
|
531
525
|
);
|
|
@@ -548,9 +542,6 @@ const ItemNodeContent = withStickiness(
|
|
|
548
542
|
<div className={css(sticky && styles.sticky)}>
|
|
549
543
|
{/* TODO(CP-4852): only pass the props to Editor that it uses. */}
|
|
550
544
|
{
|
|
551
|
-
// $FlowFixMe[incompatible-exact]: {...data} pass too many props
|
|
552
|
-
// $FlowFixMe[incompatible-type]
|
|
553
|
-
// $FlowFixMe[prop-missing]
|
|
554
545
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
555
546
|
<Editor
|
|
556
547
|
{...data}
|
|
@@ -585,13 +576,6 @@ const HintNodeContent = withStickiness(
|
|
|
585
576
|
<div className={css(styles.row)}>
|
|
586
577
|
<div className={css(styles.columnLeft)}>
|
|
587
578
|
<div className={css(sticky && styles.sticky)}>
|
|
588
|
-
{/**
|
|
589
|
-
* $FlowFixMe[incompatible-exact]
|
|
590
|
-
* TODO(somewhatabstract, JIRA-XXXX):
|
|
591
|
-
* Cannot create WrappedComponent element because
|
|
592
|
-
* inexact props [1] is incompatible with exact
|
|
593
|
-
* WithStickiness [2].
|
|
594
|
-
*/}
|
|
595
579
|
<HintEditor
|
|
596
580
|
{...data}
|
|
597
581
|
className={css(styles.hintEditor)}
|
|
@@ -673,8 +657,6 @@ const ArrayNodeContent = (props: NodePropTypes<ArrayShape, ItemArrayNode>) => {
|
|
|
673
657
|
</SimpleButton>
|
|
674
658
|
</div>
|
|
675
659
|
),
|
|
676
|
-
// $FlowFixMe[unsafe-addition]
|
|
677
|
-
// $FlowFixMe[prop-missing]
|
|
678
660
|
i < data.length - 1 && (
|
|
679
661
|
<div key="moveArrayElementDown" className={css(styles.control)}>
|
|
680
662
|
<SimpleButton
|
|
@@ -85,9 +85,6 @@ class WithState extends React.Component<Empty, State> {
|
|
|
85
85
|
...props,
|
|
86
86
|
})
|
|
87
87
|
}
|
|
88
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
89
|
-
// "widget (null) This type is incompatible with this._widget (LabelImageEditor)"
|
|
90
|
-
// $FlowFixMe[incompatible-type](0.52.0->0.53.0)
|
|
91
88
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'LabelImageEditor | null' is not assignable to type 'LabelImageEditor'.
|
|
92
89
|
ref={(widget) => (this._widget = widget)}
|
|
93
90
|
/>
|
|
@@ -102,7 +102,6 @@ class WithState extends React.Component<Empty, PerseusRadioWidgetOptions> {
|
|
|
102
102
|
...props,
|
|
103
103
|
})
|
|
104
104
|
}
|
|
105
|
-
// $FlowFixMe[incompatible-type] - can be null
|
|
106
105
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'RadioEditor | null' is not assignable to type 'RadioEditor'.
|
|
107
106
|
ref={(widget) => (this._widget = widget)}
|
|
108
107
|
/>
|
|
@@ -84,7 +84,6 @@ class CategorizerEditor extends React.Component<Props> {
|
|
|
84
84
|
{/* There are a bunch of props that renderer.jsx passes to each widget
|
|
85
85
|
via widget-container.jsx that we aren't passing to Categorizer here.
|
|
86
86
|
See perseus-all-package/types.js#WidgetProps for details. */}
|
|
87
|
-
{/* $FlowFixMe[prop-missing] */}
|
|
88
87
|
{/* @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. */}
|
|
89
88
|
<Categorizer
|
|
90
89
|
apiOptions={this.props.apiOptions}
|
|
@@ -53,7 +53,6 @@ class PairEditor extends React.Component<any> {
|
|
|
53
53
|
Name:{" "}
|
|
54
54
|
<BlurInput
|
|
55
55
|
value={this.props.name}
|
|
56
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
57
56
|
onChange={this.change("name")}
|
|
58
57
|
/>
|
|
59
58
|
</label>
|
|
@@ -62,7 +61,6 @@ class PairEditor extends React.Component<any> {
|
|
|
62
61
|
Value:{" "}
|
|
63
62
|
<BlurInput
|
|
64
63
|
value={this.props.value}
|
|
65
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
66
64
|
onChange={this.change("value")}
|
|
67
65
|
/>
|
|
68
66
|
</label>
|
|
@@ -223,8 +223,6 @@ class ExpressionEditor extends React.Component<any, any> {
|
|
|
223
223
|
className="math-input-buttons"
|
|
224
224
|
sets={this.props.buttonSets}
|
|
225
225
|
convertDotToTimes={this.props.times}
|
|
226
|
-
// onInsert is typed as `(string | ((input: $FlowFixMe) => void)) => void`
|
|
227
|
-
// $FlowFixMe[incompatible-type]
|
|
228
226
|
onInsert={this.handleTexInsert}
|
|
229
227
|
/>
|
|
230
228
|
)}
|
|
@@ -68,7 +68,6 @@ class GrapherEditor extends React.Component<Props> {
|
|
|
68
68
|
// NOTE(jeremy): This editor doesn't pass in a bunch of
|
|
69
69
|
// standard props that the Renderer provides normally (eg.
|
|
70
70
|
// alignment, findWidgets, etc).
|
|
71
|
-
// $FlowFixMe[prop-missing]
|
|
72
71
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
73
72
|
<Grapher
|
|
74
73
|
{...graphProps}
|
|
@@ -36,7 +36,6 @@ class PairEditor extends React.Component<PairEditorProps> {
|
|
|
36
36
|
Name:
|
|
37
37
|
<BlurInput
|
|
38
38
|
value={this.props.name}
|
|
39
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
40
39
|
onChange={this.change("name")}
|
|
41
40
|
/>
|
|
42
41
|
</label>
|
|
@@ -44,7 +43,6 @@ class PairEditor extends React.Component<PairEditorProps> {
|
|
|
44
43
|
Value:
|
|
45
44
|
<BlurInput
|
|
46
45
|
value={this.props.value}
|
|
47
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
48
46
|
onChange={this.change("value")}
|
|
49
47
|
/>
|
|
50
48
|
</label>
|
|
@@ -964,7 +964,6 @@ class InteractionEditor extends React.Component<
|
|
|
964
964
|
markings={this.props.graph.markings}
|
|
965
965
|
onChange={this._updateGraphProps}
|
|
966
966
|
/>
|
|
967
|
-
{/* $FlowFixMe[incompatible-type] */}
|
|
968
967
|
{this.props.graph.valid !== true && (
|
|
969
968
|
<div>{this.props.graph.valid}</div>
|
|
970
969
|
)}
|
|
@@ -122,7 +122,6 @@ const InteractiveGraphEditor: any = createReactClass({
|
|
|
122
122
|
// There are a bunch of props that renderer.jsx passes to widgets via
|
|
123
123
|
// getWidgetProps() and widget-container.jsx that the editors don't
|
|
124
124
|
// bother passing.
|
|
125
|
-
// $FlowFixMe[prop-missing]
|
|
126
125
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
127
126
|
<InteractiveGraph
|
|
128
127
|
{...graphProps}
|
|
@@ -162,7 +162,6 @@ export default class Marker extends React.Component<MarkerProps, MarkerState> {
|
|
|
162
162
|
<OptionGroup
|
|
163
163
|
onSelected={this.handleSelectAnswer}
|
|
164
164
|
// TODO(WB-1096): make selectedValues immutable in wonder-blocks
|
|
165
|
-
// $FlowFixMe[incompatible-type]
|
|
166
165
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
167
166
|
selectedValues={answers}
|
|
168
167
|
>
|
|
@@ -852,7 +852,6 @@ class TransformationsShapeEditor extends React.Component<any> {
|
|
|
852
852
|
|
|
853
853
|
updateCoords = () => {
|
|
854
854
|
this.props.onChange({
|
|
855
|
-
// $FlowFixMe[prop-missing]
|
|
856
855
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
|
|
857
856
|
shape: this.shape.toJSON(),
|
|
858
857
|
});
|