@khanacademy/perseus-editor 2.11.0 → 2.12.1

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.
@@ -1,16 +0,0 @@
1
- import PropTypes from "prop-types";
2
- import * as React from "react";
3
- type Props = any;
4
- type State = any;
5
- declare class KatexErrorView extends React.Component<Props, State> {
6
- static propTypes: {
7
- errorList: PropTypes.Validator<(PropTypes.InferProps<{
8
- math: PropTypes.Validator<string>;
9
- message: PropTypes.Validator<string>;
10
- }> | null | undefined)[]>;
11
- };
12
- state: State;
13
- handleToggleKatexErrors: (arg1: React.MouseEvent) => void;
14
- render(): React.ReactNode;
15
- }
16
- export default KatexErrorView;
@@ -1,86 +0,0 @@
1
- /**
2
- * Displays a collapsable list of KaTeX rendering errors.
3
- */
4
- import {css, StyleSheet} from "aphrodite";
5
- import PropTypes from "prop-types";
6
- import * as React from "react";
7
-
8
- type Props = any;
9
- type State = any;
10
-
11
- class KatexErrorView extends React.Component<Props, State> {
12
- static propTypes = {
13
- errorList: PropTypes.arrayOf(
14
- PropTypes.shape({
15
- math: PropTypes.string.isRequired,
16
- message: PropTypes.string.isRequired,
17
- }),
18
- ).isRequired,
19
- };
20
-
21
- state: State = {
22
- showErrors: false,
23
- };
24
-
25
- handleToggleKatexErrors: (arg1: React.MouseEvent) => void = (e) => {
26
- this.setState({showErrors: !this.state.showErrors});
27
- };
28
-
29
- render(): React.ReactNode {
30
- const {errorList} = this.props;
31
- const {showErrors} = this.state;
32
-
33
- // TODO(riley) replace with SVG icons
34
- const disclosureClass = showErrors
35
- ? "icon-chevron-down"
36
- : "icon-chevron-right";
37
-
38
- return (
39
- <div className={css(styles.errorContainer)}>
40
- <div
41
- className={css(styles.title)}
42
- onClick={this.handleToggleKatexErrors}
43
- >
44
- <i className={disclosureClass} style={{fontSize: 14}} />
45
- &nbsp; KaTeX Errors ({errorList.length})
46
- </div>
47
- {showErrors && (
48
- <div className={css(styles.errorExplanation)}>
49
- These errors will cause your LaTeX to load really slowly
50
- for the student. Please fix them if you can. If you
51
- can’t because KaTeX doesn’t support the feature you
52
- need, please message Cam.
53
- </div>
54
- )}
55
- {showErrors &&
56
- errorList.map((e, index) => (
57
- <div className={css(styles.error)} key={index}>
58
- <div style={{color: "red"}}>{e.math}</div>
59
- <div>{e.message}</div>
60
- </div>
61
- ))}
62
- </div>
63
- );
64
- }
65
- }
66
-
67
- const styles = StyleSheet.create({
68
- title: {
69
- backgroundColor: "#eee",
70
- fontSize: "1.25em",
71
- padding: "4px 10px",
72
- },
73
- errorContainer: {
74
- border: "1px solid #ddd",
75
- borderTop: "none",
76
- },
77
- errorExplanation: {
78
- padding: "4px 10px",
79
- backgroundColor: "pink",
80
- },
81
- error: {
82
- padding: "4px 10px",
83
- },
84
- });
85
-
86
- export default KatexErrorView;