@khanacademy/perseus-editor 2.0.1 → 2.0.3
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 +17 -0
- package/dist/article-editor.d.ts +2 -2
- package/dist/article-editor.js.flow +2 -2
- package/dist/components/dropdown-option.d.ts +2 -2
- package/dist/components/dropdown-option.js.flow +2 -2
- package/dist/components/link.d.ts +2 -2
- package/dist/components/link.js.flow +2 -2
- package/dist/diffs/__stories__/perseus-diff-wrapper.d.ts +3 -2
- package/dist/diffs/__stories__/perseus-diff-wrapper.js.flow +3 -2
- package/dist/editor.d.ts +7 -7
- package/dist/editor.js.flow +7 -7
- package/dist/es/index.js +9 -70
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +9 -70
- package/dist/index.js.map +1 -1
- package/dist/section-control-button.d.ts +10 -1
- package/dist/section-control-button.js.flow +13 -1
- package/dist/widgets/label-image/answer-choices.d.ts +1 -1
- package/dist/widgets/label-image/answer-choices.js.flow +1 -1
- package/dist/widgets/label-image/behavior.d.ts +2 -2
- package/dist/widgets/label-image/behavior.js.flow +2 -2
- package/dist/widgets/label-image/marker.d.ts +5 -5
- package/dist/widgets/label-image/marker.js.flow +5 -7
- package/dist/widgets/label-image/question-markers.d.ts +2 -2
- package/dist/widgets/label-image/question-markers.js.flow +2 -4
- package/dist/widgets/label-image/select-image.d.ts +2 -2
- package/dist/widgets/label-image/select-image.js.flow +2 -2
- package/dist/widgets/label-image-editor.d.ts +3 -3
- package/dist/widgets/label-image-editor.js.flow +3 -3
- package/package.json +2 -2
- package/src/__stories__/section-control-button.stories.tsx +3 -3
- package/src/article-editor.tsx +2 -6
- package/src/components/dropdown-option.tsx +2 -10
- package/src/components/link.ts +2 -2
- package/src/diffs/__stories__/perseus-diff-wrapper.tsx +4 -2
- package/src/diffs/__stories__/structured-item-diff.stories.tsx +5 -9
- package/src/diffs/__stories__/tags-diff.stories.tsx +1 -1
- package/src/diffs/__stories__/text-diff.stories.tsx +1 -1
- package/src/diffs/text-diff.tsx +0 -1
- package/src/diffs/widget-diff.tsx +0 -2
- package/src/editor.tsx +8 -11
- package/src/multirenderer-editor.tsx +8 -32
- package/src/widgets/__stories__/label-image-editor.stories.tsx +1 -4
- package/src/widgets/__stories__/radio-editor.stories.tsx +1 -2
- 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/__stories__/answer-choices.stories.tsx +3 -7
- package/src/widgets/label-image/__stories__/behavior.stories.tsx +1 -1
- package/src/widgets/label-image/__stories__/marker.stories.tsx +2 -2
- package/src/widgets/label-image/__stories__/question-markers.stories.tsx +3 -3
- package/src/widgets/label-image/__stories__/select-image.stories.tsx +3 -3
- package/src/widgets/label-image/answer-choices.tsx +5 -5
- package/src/widgets/label-image/behavior.tsx +3 -3
- package/src/widgets/label-image/marker.tsx +5 -6
- package/src/widgets/label-image/question-markers.tsx +2 -2
- package/src/widgets/label-image/select-image.tsx +2 -5
- package/src/widgets/label-image-editor.tsx +3 -3
- package/src/widgets/numeric-input-editor.tsx +0 -20
- package/src/widgets/transformer-editor.tsx +0 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @khanacademy/perseus-editor
|
|
2
2
|
|
|
3
|
+
## 2.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 472e20e1: Remove all references to multipleNumberInput (ie. Ask for (one|all) correct solution)
|
|
8
|
+
- 22c5d564: Remove the use of React.FC<> and use types named Props/State in more components
|
|
9
|
+
- Updated dependencies [472e20e1]
|
|
10
|
+
- Updated dependencies [22c5d564]
|
|
11
|
+
- @khanacademy/perseus@5.0.0
|
|
12
|
+
|
|
13
|
+
## 2.0.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [90c1833e]
|
|
18
|
+
- @khanacademy/perseus@4.0.2
|
|
19
|
+
|
|
3
20
|
## 2.0.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/article-editor.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ type DefaultProps = {
|
|
|
19
19
|
sectionImageUploadGenerator: (i: number) => React.ReactElement<React.ComponentProps<"span">>;
|
|
20
20
|
useNewStyles: boolean;
|
|
21
21
|
};
|
|
22
|
-
type
|
|
22
|
+
type Props = DefaultProps & {
|
|
23
23
|
apiOptions?: APIOptions;
|
|
24
24
|
imageUploader?: (arg1: string, arg2: (arg1: string) => unknown) => unknown;
|
|
25
25
|
previewURL: string;
|
|
@@ -27,7 +27,7 @@ type PerseusArticleEditorProps = DefaultProps & {
|
|
|
27
27
|
type State = {
|
|
28
28
|
highlightLint: boolean;
|
|
29
29
|
};
|
|
30
|
-
export default class ArticleEditor extends React.Component<
|
|
30
|
+
export default class ArticleEditor extends React.Component<Props, State> {
|
|
31
31
|
static defaultProps: DefaultProps;
|
|
32
32
|
state: State;
|
|
33
33
|
componentDidMount(): void;
|
|
@@ -23,7 +23,7 @@ declare type DefaultProps = {|
|
|
|
23
23
|
) => React.Element<"span">,
|
|
24
24
|
useNewStyles: boolean,
|
|
25
25
|
|};
|
|
26
|
-
declare type
|
|
26
|
+
declare type Props = {|
|
|
27
27
|
...DefaultProps,
|
|
28
28
|
...{|
|
|
29
29
|
apiOptions?: APIOptions,
|
|
@@ -36,7 +36,7 @@ declare type State = {|
|
|
|
36
36
|
highlightLint: boolean,
|
|
37
37
|
|};
|
|
38
38
|
declare export default class ArticleEditor
|
|
39
|
-
extends React.Component<
|
|
39
|
+
extends React.Component<Props, State>
|
|
40
40
|
{
|
|
41
41
|
static defaultProps: DefaultProps;
|
|
42
42
|
state: State;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export type OptionRenderer = (children: React.ReactElement<any> | null | undefined, value: string, selected: boolean, disabled?: boolean) => React.ReactElement<any>;
|
|
3
|
-
type
|
|
3
|
+
type Props = {
|
|
4
4
|
value: string;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
selected?: boolean;
|
|
@@ -13,7 +13,7 @@ type OptionProps = {
|
|
|
13
13
|
ariaLabel?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const optionHeight = 30;
|
|
16
|
-
declare class Option extends React.Component<
|
|
16
|
+
declare class Option extends React.Component<Props> {
|
|
17
17
|
node: HTMLDivElement;
|
|
18
18
|
handleKeyDown(event: any): void;
|
|
19
19
|
render(): React.ReactNode;
|
|
@@ -11,7 +11,7 @@ export type OptionRenderer = (
|
|
|
11
11
|
selected: boolean,
|
|
12
12
|
disabled?: boolean
|
|
13
13
|
) => React.Element<any>;
|
|
14
|
-
declare type
|
|
14
|
+
declare type Props = {|
|
|
15
15
|
value: string,
|
|
16
16
|
children?: React.Node,
|
|
17
17
|
selected?: boolean,
|
|
@@ -24,7 +24,7 @@ declare type OptionProps = {|
|
|
|
24
24
|
ariaLabel?: string,
|
|
25
25
|
|};
|
|
26
26
|
declare export var optionHeight: 30;
|
|
27
|
-
declare class Option extends React.Component<
|
|
27
|
+
declare class Option extends React.Component<Props> {
|
|
28
28
|
node: HTMLDivElement;
|
|
29
29
|
handleKeyDown(event: any): void;
|
|
30
30
|
render(): React.Node;
|
|
@@ -6,7 +6,7 @@ type DefaultProps = {
|
|
|
6
6
|
href: string;
|
|
7
7
|
style: CSSProperties | Array<CSSProperties>;
|
|
8
8
|
};
|
|
9
|
-
type
|
|
9
|
+
type Props = DefaultProps & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
className?: string;
|
|
12
12
|
inlineStyles?: {
|
|
@@ -34,7 +34,7 @@ type LinkProps = DefaultProps & {
|
|
|
34
34
|
/**
|
|
35
35
|
* A wrapper that creates an anchor tag with normalized styles
|
|
36
36
|
*/
|
|
37
|
-
declare class Link extends React.Component<
|
|
37
|
+
declare class Link extends React.Component<Props> {
|
|
38
38
|
static defaultProps: DefaultProps;
|
|
39
39
|
render(): React.ReactNode;
|
|
40
40
|
}
|
|
@@ -12,7 +12,7 @@ declare type DefaultProps = {|
|
|
|
12
12
|
href: string,
|
|
13
13
|
style: CSSProperties | Array<CSSProperties>,
|
|
14
14
|
|};
|
|
15
|
-
declare type
|
|
15
|
+
declare type Props = {|
|
|
16
16
|
...DefaultProps,
|
|
17
17
|
...{|
|
|
18
18
|
children?: React.Node,
|
|
@@ -43,7 +43,7 @@ declare type LinkProps = {|
|
|
|
43
43
|
/**
|
|
44
44
|
* A wrapper that creates an anchor tag with normalized styles
|
|
45
45
|
*/
|
|
46
|
-
declare class Link extends React.Component<
|
|
46
|
+
declare class Link extends React.Component<Props> {
|
|
47
47
|
static defaultProps: DefaultProps;
|
|
48
48
|
render(): React.Node;
|
|
49
49
|
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
declare
|
|
8
|
+
declare type Props = {|
|
|
9
9
|
children: React.Node,
|
|
10
|
-
|}
|
|
10
|
+
|};
|
|
11
|
+
declare var Wrapper: (x: Props) => React.Element<any>;
|
|
11
12
|
declare export default typeof Wrapper;
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import katex from "katex";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import type { ChangeHandler, WidgetInfo } from "@khanacademy/perseus";
|
|
4
|
-
type
|
|
4
|
+
type Props = Readonly<{
|
|
5
5
|
apiOptions: any;
|
|
6
6
|
className?: string;
|
|
7
7
|
content: string;
|
|
@@ -34,20 +34,20 @@ type DeafultProps = {
|
|
|
34
34
|
[name: string]: WidgetInfo;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
type
|
|
37
|
+
type State = {
|
|
38
38
|
showKatexErrors: boolean;
|
|
39
39
|
textAreaValue: string;
|
|
40
40
|
katex?: katex;
|
|
41
41
|
};
|
|
42
|
-
declare class Editor extends React.Component<
|
|
42
|
+
declare class Editor extends React.Component<Props, State> {
|
|
43
43
|
lastUserValue: string | null | undefined;
|
|
44
44
|
deferredChange: any | null | undefined;
|
|
45
45
|
widgetIds: any | null | undefined;
|
|
46
46
|
static defaultProps: DeafultProps;
|
|
47
|
-
state:
|
|
47
|
+
state: State;
|
|
48
48
|
componentDidMount(): void;
|
|
49
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
50
|
-
componentDidUpdate(prevProps:
|
|
49
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
50
|
+
componentDidUpdate(prevProps: Props): void;
|
|
51
51
|
componentWillUnmount(): void;
|
|
52
52
|
getWidgetEditor: (id: string, type: string) => undefined | React.ReactNode;
|
|
53
53
|
_handleWidgetEditorChange: (id: string, newWidgetInfo: WidgetInfo, cb?: () => unknown, silent?: boolean) => void;
|
|
@@ -56,7 +56,7 @@ declare class Editor extends React.Component<EditorProps, EditorState> {
|
|
|
56
56
|
* Calculate the size of all the images in props.content, and send
|
|
57
57
|
* those sizes to this.props.images using props.onChange.
|
|
58
58
|
*/
|
|
59
|
-
_sizeImages: (props:
|
|
59
|
+
_sizeImages: (props: Props) => void;
|
|
60
60
|
handleDrop: (e: DragEvent) => void;
|
|
61
61
|
handleChange: (e: React.SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
62
62
|
_handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
package/dist/editor.js.flow
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import katex from "katex";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { ChangeHandler, WidgetInfo } from "@khanacademy/perseus";
|
|
10
|
-
declare type
|
|
10
|
+
declare type Props = $ReadOnly<{|
|
|
11
11
|
apiOptions: any,
|
|
12
12
|
className?: string,
|
|
13
13
|
content: string,
|
|
@@ -40,20 +40,20 @@ declare type DeafultProps = {|
|
|
|
40
40
|
[name: string]: WidgetInfo,
|
|
41
41
|
},
|
|
42
42
|
|};
|
|
43
|
-
declare type
|
|
43
|
+
declare type State = {|
|
|
44
44
|
showKatexErrors: boolean,
|
|
45
45
|
textAreaValue: string,
|
|
46
46
|
katex?: katex,
|
|
47
47
|
|};
|
|
48
|
-
declare class Editor extends React.Component<
|
|
48
|
+
declare class Editor extends React.Component<Props, State> {
|
|
49
49
|
lastUserValue: string | null | void;
|
|
50
50
|
deferredChange: any | null | void;
|
|
51
51
|
widgetIds: any | null | void;
|
|
52
52
|
static defaultProps: DeafultProps;
|
|
53
|
-
state:
|
|
53
|
+
state: State;
|
|
54
54
|
componentDidMount(): void;
|
|
55
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
56
|
-
componentDidUpdate(prevProps:
|
|
55
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
56
|
+
componentDidUpdate(prevProps: Props): void;
|
|
57
57
|
componentWillUnmount(): void;
|
|
58
58
|
getWidgetEditor: (id: string, type: string) => void | React.Node;
|
|
59
59
|
_handleWidgetEditorChange: (
|
|
@@ -68,7 +68,7 @@ declare class Editor extends React.Component<EditorProps, EditorState> {
|
|
|
68
68
|
* Calculate the size of all the images in props.content, and send
|
|
69
69
|
* those sizes to this.props.images using props.onChange.
|
|
70
70
|
*/
|
|
71
|
-
_sizeImages: (props:
|
|
71
|
+
_sizeImages: (props: Props) => void;
|
|
72
72
|
handleDrop: (e: DragEvent) => void;
|
|
73
73
|
handleChange: (e: SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
74
74
|
_handleKeyDown: (e: SyntheticKeyboardEvent<HTMLTextAreaElement>) => void;
|
package/dist/es/index.js
CHANGED
|
@@ -1002,7 +1002,6 @@ class Editor extends React.Component {
|
|
|
1002
1002
|
}, function () {
|
|
1003
1003
|
Util.textarea.moveCursor(
|
|
1004
1004
|
// findDOMNode can return Text but we know this is Element
|
|
1005
|
-
// $FlowFixMe[incompatible-call]
|
|
1006
1005
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
|
|
1007
1006
|
textarea,
|
|
1008
1007
|
// We want to put the cursor after the widget
|
|
@@ -1856,7 +1855,6 @@ class ArticleEditor extends React.Component {
|
|
|
1856
1855
|
}
|
|
1857
1856
|
ArticleEditor.defaultProps = {
|
|
1858
1857
|
contentPaths: [],
|
|
1859
|
-
// $FlowFixMe[incompatible-exact]
|
|
1860
1858
|
json: [{}],
|
|
1861
1859
|
mode: "edit",
|
|
1862
1860
|
screen: "desktop",
|
|
@@ -4601,7 +4599,7 @@ class ModeDropdown extends React.Component {
|
|
|
4601
4599
|
this._handleSelectMode = event => {
|
|
4602
4600
|
if (this.props.onChange) {
|
|
4603
4601
|
// event.target.value corresponds to the options' values below which
|
|
4604
|
-
// are limited to EditorMode, but
|
|
4602
|
+
// are limited to EditorMode, but TypeScript doesn't know that so we have
|
|
4605
4603
|
// to cast through any here.
|
|
4606
4604
|
const value = event.target.value;
|
|
4607
4605
|
this.props.onChange(value);
|
|
@@ -4673,7 +4671,6 @@ const Header = _ref => {
|
|
|
4673
4671
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
4674
4672
|
const headerLevel = Math.min(depth, 5) + 1;
|
|
4675
4673
|
const HeaderTag = `h${headerLevel}`;
|
|
4676
|
-
// @ts-expect-error [FEI-5003] - TS2559 - Type '{ children?: ReactNode; }' has no properties in common with type 'IntrinsicAttributes'.
|
|
4677
4674
|
return /*#__PURE__*/React.createElement(HeaderTag, props);
|
|
4678
4675
|
};
|
|
4679
4676
|
|
|
@@ -4835,7 +4832,7 @@ const NodeContent = props => {
|
|
|
4835
4832
|
|
|
4836
4833
|
// All uses of `data` have been cast through any which isn't safe. This was
|
|
4837
4834
|
// done to avoid introducing new logic which may have resulted in a change
|
|
4838
|
-
// of behavior. Also, there doesn't appear to be a way to tell
|
|
4835
|
+
// of behavior. Also, there doesn't appear to be a way to tell TypeScript the
|
|
4839
4836
|
// difference between and `TagsNode` and `ItemArrayNode`, see
|
|
4840
4837
|
// perseus-all-package/multi-items/item-types.js.
|
|
4841
4838
|
if (shape.type === "content") {
|
|
@@ -4914,12 +4911,6 @@ const withStickiness = WrappedComponent => {
|
|
|
4914
4911
|
render() {
|
|
4915
4912
|
return (
|
|
4916
4913
|
/*#__PURE__*/
|
|
4917
|
-
/**
|
|
4918
|
-
* $FlowFixMe[incompatible-exact]
|
|
4919
|
-
* TODO(somewhatabstract, JIRA-XXXX):
|
|
4920
|
-
* Cannot create WrappedComponent element because inexact props
|
|
4921
|
-
* [1] is incompatible with exact WithStickiness [2].
|
|
4922
|
-
*/
|
|
4923
4914
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
|
|
4924
4915
|
React.createElement(WrappedComponent, _extends({}, this.props, {
|
|
4925
4916
|
sticky: this.state.sticky
|
|
@@ -4948,9 +4939,6 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
4948
4939
|
className: css(sticky && styles$c.sticky)
|
|
4949
4940
|
},
|
|
4950
4941
|
/*#__PURE__*/
|
|
4951
|
-
// $FlowFixMe[incompatible-exact]: {...data} pass too many props
|
|
4952
|
-
// $FlowFixMe[incompatible-type]
|
|
4953
|
-
// $FlowFixMe[prop-missing]
|
|
4954
4942
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
4955
4943
|
React.createElement(Editor, _extends({}, data, {
|
|
4956
4944
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
@@ -5054,10 +5042,7 @@ const ArrayNodeContent = props => {
|
|
|
5054
5042
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
5055
5043
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5056
5044
|
className: css(styles$c.verticalFlip)
|
|
5057
|
-
}, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown)))),
|
|
5058
|
-
// $FlowFixMe[unsafe-addition]
|
|
5059
|
-
// $FlowFixMe[prop-missing]
|
|
5060
|
-
i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
5045
|
+
}, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
5061
5046
|
key: "moveArrayElementDown",
|
|
5062
5047
|
className: css(styles$c.control)
|
|
5063
5048
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
@@ -5677,14 +5662,10 @@ class PairEditor$1 extends React.Component {
|
|
|
5677
5662
|
return /*#__PURE__*/React.createElement("fieldset", {
|
|
5678
5663
|
className: "pair-editor"
|
|
5679
5664
|
}, /*#__PURE__*/React.createElement("label", null, "Name:", " ", /*#__PURE__*/React.createElement(BlurInput, {
|
|
5680
|
-
value: this.props.name
|
|
5681
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
5682
|
-
,
|
|
5665
|
+
value: this.props.name,
|
|
5683
5666
|
onChange: this.change("name")
|
|
5684
5667
|
})), /*#__PURE__*/React.createElement("label", null, " ", "Value:", " ", /*#__PURE__*/React.createElement(BlurInput, {
|
|
5685
|
-
value: this.props.value
|
|
5686
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
5687
|
-
,
|
|
5668
|
+
value: this.props.value,
|
|
5688
5669
|
onChange: this.change("value")
|
|
5689
5670
|
})));
|
|
5690
5671
|
}
|
|
@@ -6790,10 +6771,7 @@ class ExpressionEditor extends React.Component {
|
|
|
6790
6771
|
})), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Button sets:"), buttonSetChoices), this.state.isTex && /*#__PURE__*/React.createElement(TexButtons, {
|
|
6791
6772
|
className: "math-input-buttons",
|
|
6792
6773
|
sets: this.props.buttonSets,
|
|
6793
|
-
convertDotToTimes: this.props.times
|
|
6794
|
-
// onInsert is typed as `(string | ((input: $FlowFixMe) => void)) => void`
|
|
6795
|
-
// $FlowFixMe[incompatible-type]
|
|
6796
|
-
,
|
|
6774
|
+
convertDotToTimes: this.props.times,
|
|
6797
6775
|
onInsert: this.handleTexInsert
|
|
6798
6776
|
}), /*#__PURE__*/React.createElement("h3", {
|
|
6799
6777
|
className: "expression-editor-h3"
|
|
@@ -7662,7 +7640,6 @@ class GrapherEditor extends React.Component {
|
|
|
7662
7640
|
// NOTE(jeremy): This editor doesn't pass in a bunch of
|
|
7663
7641
|
// standard props that the Renderer provides normally (eg.
|
|
7664
7642
|
// alignment, findWidgets, etc).
|
|
7665
|
-
// $FlowFixMe[prop-missing]
|
|
7666
7643
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
7667
7644
|
React.createElement(Grapher, _extends({}, graphProps, {
|
|
7668
7645
|
apiOptions: this.props.apiOptions,
|
|
@@ -7789,14 +7766,10 @@ class PairEditor extends React.Component {
|
|
|
7789
7766
|
}
|
|
7790
7767
|
render() {
|
|
7791
7768
|
return /*#__PURE__*/React.createElement("fieldset", null, /*#__PURE__*/React.createElement("label", null, "Name:", /*#__PURE__*/React.createElement(BlurInput, {
|
|
7792
|
-
value: this.props.name
|
|
7793
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
7794
|
-
,
|
|
7769
|
+
value: this.props.name,
|
|
7795
7770
|
onChange: this.change("name")
|
|
7796
7771
|
})), /*#__PURE__*/React.createElement("label", null, "Value:", /*#__PURE__*/React.createElement(BlurInput, {
|
|
7797
|
-
value: this.props.value
|
|
7798
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
7799
|
-
,
|
|
7772
|
+
value: this.props.value,
|
|
7800
7773
|
onChange: this.change("value")
|
|
7801
7774
|
})));
|
|
7802
7775
|
}
|
|
@@ -8264,9 +8237,7 @@ class InputNumberEditor extends React.Component {
|
|
|
8264
8237
|
disabled: !this.props.inexact,
|
|
8265
8238
|
defaultValue: this.props.maxError,
|
|
8266
8239
|
onBlur: e => {
|
|
8267
|
-
const ans = "" + (
|
|
8268
|
-
// $FlowFixMe[incompatible-type]
|
|
8269
|
-
Util.firstNumericalParse(e.target.value) || 0);
|
|
8240
|
+
const ans = "" + (Util.firstNumericalParse(e.target.value) || 0);
|
|
8270
8241
|
e.target.value = ans;
|
|
8271
8242
|
this.props.onChange({
|
|
8272
8243
|
maxError: ans
|
|
@@ -9613,7 +9584,6 @@ const InteractiveGraphEditor = createReactClass({
|
|
|
9613
9584
|
// There are a bunch of props that renderer.jsx passes to widgets via
|
|
9614
9585
|
// getWidgetProps() and widget-container.jsx that the editors don't
|
|
9615
9586
|
// bother passing.
|
|
9616
|
-
// $FlowFixMe[prop-missing]
|
|
9617
9587
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
9618
9588
|
React.createElement(InteractiveGraph, _extends({}, graphProps, {
|
|
9619
9589
|
containerSizeClass: sizeClass,
|
|
@@ -10497,9 +10467,6 @@ class Option extends React.Component {
|
|
|
10497
10467
|
ariaLabel
|
|
10498
10468
|
} = this.props;
|
|
10499
10469
|
return /*#__PURE__*/React.createElement("button", {
|
|
10500
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
10501
|
-
// "node (null) This type is incompatible with this.node (HTMLDivElement)"
|
|
10502
|
-
// $FlowFixMe[incompatible-type](0.52.0->0.53.0)
|
|
10503
10470
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
|
|
10504
10471
|
ref: node => this.node = node,
|
|
10505
10472
|
value: value,
|
|
@@ -10510,11 +10477,6 @@ class Option extends React.Component {
|
|
|
10510
10477
|
,
|
|
10511
10478
|
onClick: value => {
|
|
10512
10479
|
if (!disabled && onClick) {
|
|
10513
|
-
// TODO(mdr): We found a new Flow error here when upgrading
|
|
10514
|
-
// from 0.35.0 to 0.52.0: "value (unused function
|
|
10515
|
-
// argument)". This comment was automatically added to
|
|
10516
|
-
// this file, to suppress the error for now. Please
|
|
10517
|
-
// consider fixing!
|
|
10518
10480
|
// @ts-expect-error [FEI-5003] - TS2554 - Expected 0 arguments, but got 1.
|
|
10519
10481
|
onClick(value);
|
|
10520
10482
|
}
|
|
@@ -10771,7 +10733,6 @@ class Marker extends React.Component {
|
|
|
10771
10733
|
}), /*#__PURE__*/React.createElement(OptionGroup, {
|
|
10772
10734
|
onSelected: this.handleSelectAnswer
|
|
10773
10735
|
// TODO(WB-1096): make selectedValues immutable in wonder-blocks
|
|
10774
|
-
// $FlowFixMe[incompatible-type]
|
|
10775
10736
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
10776
10737
|
,
|
|
10777
10738
|
selectedValues: answers
|
|
@@ -12163,7 +12124,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12163
12124
|
size: "normal",
|
|
12164
12125
|
coefficient: false,
|
|
12165
12126
|
labelText: "",
|
|
12166
|
-
multipleNumberInput: false,
|
|
12167
12127
|
rightAlign: false
|
|
12168
12128
|
};
|
|
12169
12129
|
},
|
|
@@ -12357,14 +12317,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12357
12317
|
return /*#__PURE__*/React.createElement("div", {
|
|
12358
12318
|
className: "perseus-input-number-editor"
|
|
12359
12319
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12360
|
-
ref: e => this.multInputOption = e
|
|
12361
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
12362
|
-
onChange: this.onMultipleInputChange
|
|
12363
|
-
}, /*#__PURE__*/React.createElement("option", {
|
|
12364
|
-
value: "simple-numeric-input"
|
|
12365
|
-
}, "Ask for one correct solution"), /*#__PURE__*/React.createElement("option", {
|
|
12366
|
-
value: "multiple-numeric-input"
|
|
12367
|
-
}, "Ask for all correct solutions"))), /*#__PURE__*/React.createElement("div", {
|
|
12368
12320
|
className: "ui-title"
|
|
12369
12321
|
}, "User input"), /*#__PURE__*/React.createElement("div", {
|
|
12370
12322
|
className: "msg-title"
|
|
@@ -12407,18 +12359,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12407
12359
|
simplify: newStatus === "correct" ? "required" : "accepted"
|
|
12408
12360
|
});
|
|
12409
12361
|
},
|
|
12410
|
-
onMultipleInputChange: function (event) {
|
|
12411
|
-
const newOption = event.target.value;
|
|
12412
|
-
if (newOption === "multiple-numeric-input") {
|
|
12413
|
-
this.props.onChange({
|
|
12414
|
-
multipleNumberInput: true
|
|
12415
|
-
});
|
|
12416
|
-
} else {
|
|
12417
|
-
this.props.onChange({
|
|
12418
|
-
multipleNumberInput: false
|
|
12419
|
-
});
|
|
12420
|
-
}
|
|
12421
|
-
},
|
|
12422
12362
|
updateAnswer: function (choiceIndex, update) {
|
|
12423
12363
|
if (!_.isObject(update)) {
|
|
12424
12364
|
return _.partial((choiceIndex, key, value) => {
|
|
@@ -14520,7 +14460,6 @@ class TransformationsShapeEditor extends React.Component {
|
|
|
14520
14460
|
};
|
|
14521
14461
|
this.updateCoords = () => {
|
|
14522
14462
|
this.props.onChange({
|
|
14523
|
-
// $FlowFixMe[prop-missing]
|
|
14524
14463
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
|
|
14525
14464
|
shape: this.shape.toJSON()
|
|
14526
14465
|
});
|