@khanacademy/perseus-editor 2.0.2 → 2.1.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/CHANGELOG.md +52 -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 -10
- package/dist/editor.js.flow +7 -10
- package/dist/es/index.js +17430 -45
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +17429 -44
- package/dist/index.js.map +1 -1
- package/dist/section-control-button.d.ts +7 -1
- package/dist/section-control-button.js.flow +7 -2
- 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/dist/widgets/unit-editor.d.ts +1 -1
- package/dist/widgets/unit-editor.js.flow +1 -1
- package/package.json +2 -2
- package/src/__stories__/editor.stories.tsx +1 -2
- package/src/__stories__/section-control-button.stories.tsx +3 -3
- package/src/__tests__/editor.test.tsx +4 -4
- package/src/article-editor.tsx +13 -21
- 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 +9 -26
- 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.json → tsconfig-build.json} +3 -3
- package/tsconfig-build.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @khanacademy/perseus-editor
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4a368030: Remove getKaTeX from the PerseusDependencies type
|
|
8
|
+
|
|
9
|
+
perseus-editor now detects KaTeX rendering errors by calling KaTeX directly,
|
|
10
|
+
rather than using getKaTeX from PerseusDependencies.
|
|
11
|
+
|
|
12
|
+
The logKaTeXError method, which was unused by Perseus, has been removed from
|
|
13
|
+
the PerseusDependencies type as well.
|
|
14
|
+
|
|
15
|
+
Clients should update their code by removing the getKaTeX and logKaTeXError
|
|
16
|
+
properties from their PerseusDependencies object. If they want to log an error
|
|
17
|
+
when TeX fails to render, they should do so in their TeX component.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 9c4a6c96: Remove obsolete properties from the PerseusDependencies type
|
|
22
|
+
|
|
23
|
+
We are in the process of migrating the webapp and mobile repos to use
|
|
24
|
+
MathJax 3 as their math renderer instead of KaTeX. This change removes some of
|
|
25
|
+
Perseus's dependencies on KaTeX.
|
|
26
|
+
|
|
27
|
+
Clients should update their code by removing the `getRenderA11yString`,
|
|
28
|
+
`loadMathjax`, `KatexProvider`, and `shouldUseFutureKaTeX` properties from
|
|
29
|
+
their PerseusDependencies object.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [4a368030]
|
|
32
|
+
- Updated dependencies [5cc23179]
|
|
33
|
+
- Updated dependencies [e0a087d0]
|
|
34
|
+
- Updated dependencies [b062ad47]
|
|
35
|
+
- Updated dependencies [8a47076d]
|
|
36
|
+
- Updated dependencies [09ab3260]
|
|
37
|
+
- Updated dependencies [5432857d]
|
|
38
|
+
- Updated dependencies [40c2736d]
|
|
39
|
+
- Updated dependencies [b585fe29]
|
|
40
|
+
- Updated dependencies [91617cfa]
|
|
41
|
+
- Updated dependencies [e284e7c1]
|
|
42
|
+
- Updated dependencies [9c4a6c96]
|
|
43
|
+
- @khanacademy/perseus@6.0.0
|
|
44
|
+
|
|
45
|
+
## 2.0.3
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 472e20e1: Remove all references to multipleNumberInput (ie. Ask for (one|all) correct solution)
|
|
50
|
+
- 22c5d564: Remove the use of React.FC<> and use types named Props/State in more components
|
|
51
|
+
- Updated dependencies [472e20e1]
|
|
52
|
+
- Updated dependencies [22c5d564]
|
|
53
|
+
- @khanacademy/perseus@5.0.0
|
|
54
|
+
|
|
3
55
|
## 2.0.2
|
|
4
56
|
|
|
5
57
|
### 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,6 @@
|
|
|
1
|
-
import katex from "katex";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { ChangeHandler, WidgetInfo } from "@khanacademy/perseus";
|
|
4
|
-
type
|
|
3
|
+
type Props = Readonly<{
|
|
5
4
|
apiOptions: any;
|
|
6
5
|
className?: string;
|
|
7
6
|
content: string;
|
|
@@ -34,20 +33,18 @@ type DeafultProps = {
|
|
|
34
33
|
[name: string]: WidgetInfo;
|
|
35
34
|
};
|
|
36
35
|
};
|
|
37
|
-
type
|
|
38
|
-
showKatexErrors: boolean;
|
|
36
|
+
type State = {
|
|
39
37
|
textAreaValue: string;
|
|
40
|
-
katex?: katex;
|
|
41
38
|
};
|
|
42
|
-
declare class Editor extends React.Component<
|
|
39
|
+
declare class Editor extends React.Component<Props, State> {
|
|
43
40
|
lastUserValue: string | null | undefined;
|
|
44
41
|
deferredChange: any | null | undefined;
|
|
45
42
|
widgetIds: any | null | undefined;
|
|
46
43
|
static defaultProps: DeafultProps;
|
|
47
|
-
state:
|
|
44
|
+
state: State;
|
|
48
45
|
componentDidMount(): void;
|
|
49
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
50
|
-
componentDidUpdate(prevProps:
|
|
46
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
47
|
+
componentDidUpdate(prevProps: Props): void;
|
|
51
48
|
componentWillUnmount(): void;
|
|
52
49
|
getWidgetEditor: (id: string, type: string) => undefined | React.ReactNode;
|
|
53
50
|
_handleWidgetEditorChange: (id: string, newWidgetInfo: WidgetInfo, cb?: () => unknown, silent?: boolean) => void;
|
|
@@ -56,7 +53,7 @@ declare class Editor extends React.Component<EditorProps, EditorState> {
|
|
|
56
53
|
* Calculate the size of all the images in props.content, and send
|
|
57
54
|
* those sizes to this.props.images using props.onChange.
|
|
58
55
|
*/
|
|
59
|
-
_sizeImages: (props:
|
|
56
|
+
_sizeImages: (props: Props) => void;
|
|
60
57
|
handleDrop: (e: DragEvent) => void;
|
|
61
58
|
handleChange: (e: React.SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
62
59
|
_handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
package/dist/editor.js.flow
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import katex from "katex";
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { ChangeHandler, WidgetInfo } from "@khanacademy/perseus";
|
|
10
|
-
declare type
|
|
9
|
+
declare type Props = $ReadOnly<{|
|
|
11
10
|
apiOptions: any,
|
|
12
11
|
className?: string,
|
|
13
12
|
content: string,
|
|
@@ -40,20 +39,18 @@ declare type DeafultProps = {|
|
|
|
40
39
|
[name: string]: WidgetInfo,
|
|
41
40
|
},
|
|
42
41
|
|};
|
|
43
|
-
declare type
|
|
44
|
-
showKatexErrors: boolean,
|
|
42
|
+
declare type State = {|
|
|
45
43
|
textAreaValue: string,
|
|
46
|
-
katex?: katex,
|
|
47
44
|
|};
|
|
48
|
-
declare class Editor extends React.Component<
|
|
45
|
+
declare class Editor extends React.Component<Props, State> {
|
|
49
46
|
lastUserValue: string | null | void;
|
|
50
47
|
deferredChange: any | null | void;
|
|
51
48
|
widgetIds: any | null | void;
|
|
52
49
|
static defaultProps: DeafultProps;
|
|
53
|
-
state:
|
|
50
|
+
state: State;
|
|
54
51
|
componentDidMount(): void;
|
|
55
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
56
|
-
componentDidUpdate(prevProps:
|
|
52
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
53
|
+
componentDidUpdate(prevProps: Props): void;
|
|
57
54
|
componentWillUnmount(): void;
|
|
58
55
|
getWidgetEditor: (id: string, type: string) => void | React.Node;
|
|
59
56
|
_handleWidgetEditorChange: (
|
|
@@ -68,7 +65,7 @@ declare class Editor extends React.Component<EditorProps, EditorState> {
|
|
|
68
65
|
* Calculate the size of all the images in props.content, and send
|
|
69
66
|
* those sizes to this.props.images using props.onChange.
|
|
70
67
|
*/
|
|
71
|
-
_sizeImages: (props:
|
|
68
|
+
_sizeImages: (props: Props) => void;
|
|
72
69
|
handleDrop: (e: DragEvent) => void;
|
|
73
70
|
handleChange: (e: SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
74
71
|
_handleKeyDown: (e: SyntheticKeyboardEvent<HTMLTextAreaElement>) => void;
|