@khanacademy/perseus-editor 2.0.2 → 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 +10 -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 +0 -22
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +0 -22
- 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 -5
- package/src/components/dropdown-option.tsx +2 -2
- 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/editor.tsx +8 -10
- package/src/multirenderer-editor.tsx +6 -12
- package/src/widgets/__stories__/label-image-editor.stories.tsx +1 -1
- package/src/widgets/__stories__/radio-editor.stories.tsx +1 -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 -5
- 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/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
|
|
3
13
|
## 2.0.2
|
|
4
14
|
|
|
5
15
|
### 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
|
@@ -4671,7 +4671,6 @@ const Header = _ref => {
|
|
|
4671
4671
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
4672
4672
|
const headerLevel = Math.min(depth, 5) + 1;
|
|
4673
4673
|
const HeaderTag = `h${headerLevel}`;
|
|
4674
|
-
// @ts-expect-error [FEI-5003] - TS2559 - Type '{ children?: ReactNode; }' has no properties in common with type 'IntrinsicAttributes'.
|
|
4675
4674
|
return /*#__PURE__*/React.createElement(HeaderTag, props);
|
|
4676
4675
|
};
|
|
4677
4676
|
|
|
@@ -12125,7 +12124,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12125
12124
|
size: "normal",
|
|
12126
12125
|
coefficient: false,
|
|
12127
12126
|
labelText: "",
|
|
12128
|
-
multipleNumberInput: false,
|
|
12129
12127
|
rightAlign: false
|
|
12130
12128
|
};
|
|
12131
12129
|
},
|
|
@@ -12319,14 +12317,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12319
12317
|
return /*#__PURE__*/React.createElement("div", {
|
|
12320
12318
|
className: "perseus-input-number-editor"
|
|
12321
12319
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12322
|
-
ref: e => this.multInputOption = e
|
|
12323
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
12324
|
-
onChange: this.onMultipleInputChange
|
|
12325
|
-
}, /*#__PURE__*/React.createElement("option", {
|
|
12326
|
-
value: "simple-numeric-input"
|
|
12327
|
-
}, "Ask for one correct solution"), /*#__PURE__*/React.createElement("option", {
|
|
12328
|
-
value: "multiple-numeric-input"
|
|
12329
|
-
}, "Ask for all correct solutions"))), /*#__PURE__*/React.createElement("div", {
|
|
12330
12320
|
className: "ui-title"
|
|
12331
12321
|
}, "User input"), /*#__PURE__*/React.createElement("div", {
|
|
12332
12322
|
className: "msg-title"
|
|
@@ -12369,18 +12359,6 @@ const NumericInputEditor = createReactClass({
|
|
|
12369
12359
|
simplify: newStatus === "correct" ? "required" : "accepted"
|
|
12370
12360
|
});
|
|
12371
12361
|
},
|
|
12372
|
-
onMultipleInputChange: function (event) {
|
|
12373
|
-
const newOption = event.target.value;
|
|
12374
|
-
if (newOption === "multiple-numeric-input") {
|
|
12375
|
-
this.props.onChange({
|
|
12376
|
-
multipleNumberInput: true
|
|
12377
|
-
});
|
|
12378
|
-
} else {
|
|
12379
|
-
this.props.onChange({
|
|
12380
|
-
multipleNumberInput: false
|
|
12381
|
-
});
|
|
12382
|
-
}
|
|
12383
|
-
},
|
|
12384
12362
|
updateAnswer: function (choiceIndex, update) {
|
|
12385
12363
|
if (!_.isObject(update)) {
|
|
12386
12364
|
return _.partial((choiceIndex, key, value) => {
|