@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.
- package/CHANGELOG.md +23 -0
- package/dist/es/index.js +42 -38
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +42 -32
- package/dist/index.js.map +1 -1
- package/dist/tex-error-view.d.ts +19 -0
- package/dist/widgets/categorizer-editor.d.ts +0 -1
- package/dist/widgets/example-graphie-widget.d.ts +0 -1
- package/dist/widgets/graded-group-editor.d.ts +0 -1
- package/dist/widgets/graded-group-set-editor.d.ts +0 -1
- package/dist/widgets/group-editor.d.ts +0 -1
- package/dist/widgets/interactive-graph-editor.d.ts +0 -92
- package/dist/widgets/radio/editor.d.ts +0 -1
- package/dist/widgets/sequence-editor.d.ts +0 -1
- package/dist/widgets/unit-editor.d.ts +1 -1
- package/package.json +7 -5
- package/src/__stories__/tex-error-view.stories.tsx +26 -0
- package/src/components/blur-input.tsx +1 -0
- package/src/components/sortable.tsx +1 -0
- package/src/components/widget-editor.tsx +1 -0
- package/src/diffs/__stories__/structured-item-diff.stories.tsx +0 -1
- package/src/editor.tsx +3 -2
- package/src/tex-error-view.tsx +90 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/katex-error-view.d.ts +0 -16
- package/src/katex-error-view.tsx +0 -86
package/dist/index.js
CHANGED
|
@@ -13,11 +13,13 @@ var Color = require('@khanacademy/wonder-blocks-color');
|
|
|
13
13
|
var aphrodite = require('aphrodite');
|
|
14
14
|
var $ = require('jquery');
|
|
15
15
|
var ReactDOM = require('react-dom');
|
|
16
|
+
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
17
|
+
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
18
|
+
var caretRight = require('@phosphor-icons/core/bold/caret-right-bold.svg');
|
|
16
19
|
var classNames = require('classnames');
|
|
17
20
|
var kmath = require('@khanacademy/kmath');
|
|
18
21
|
var KAS = require('@khanacademy/kas');
|
|
19
22
|
var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
20
|
-
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
21
23
|
var Spacing = require('@khanacademy/wonder-blocks-spacing');
|
|
22
24
|
var Typography = require('@khanacademy/wonder-blocks-typography');
|
|
23
25
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
@@ -52,6 +54,7 @@ var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
|
52
54
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
53
55
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
54
56
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
57
|
+
var caretRight__default = /*#__PURE__*/_interopDefaultLegacy(caretRight);
|
|
55
58
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
56
59
|
var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
|
|
57
60
|
var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
|
|
@@ -61,7 +64,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
|
|
|
61
64
|
|
|
62
65
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
63
66
|
const libName = "@khanacademy/perseus-editor";
|
|
64
|
-
const libVersion = "2.
|
|
67
|
+
const libVersion = "2.12.1";
|
|
65
68
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
66
69
|
|
|
67
70
|
function _extends() {
|
|
@@ -20614,6 +20617,8 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20614
20617
|
widgetInfo: _upgradeWidgetInfo(props)
|
|
20615
20618
|
};
|
|
20616
20619
|
}
|
|
20620
|
+
|
|
20621
|
+
// eslint-disable-next-line react/no-unsafe
|
|
20617
20622
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
20618
20623
|
// @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
|
|
20619
20624
|
this.setState({
|
|
@@ -20764,19 +20769,13 @@ class WidgetSelect extends React__namespace.Component {
|
|
|
20764
20769
|
}
|
|
20765
20770
|
|
|
20766
20771
|
/**
|
|
20767
|
-
* Displays a collapsable list of
|
|
20772
|
+
* Displays a collapsable list of TeX rendering errors.
|
|
20768
20773
|
*/
|
|
20769
|
-
class
|
|
20770
|
-
static propTypes = {
|
|
20771
|
-
errorList: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
20772
|
-
math: PropTypes__default["default"].string.isRequired,
|
|
20773
|
-
message: PropTypes__default["default"].string.isRequired
|
|
20774
|
-
})).isRequired
|
|
20775
|
-
};
|
|
20774
|
+
class TexErrorView extends React__namespace.Component {
|
|
20776
20775
|
state = {
|
|
20777
20776
|
showErrors: false
|
|
20778
20777
|
};
|
|
20779
|
-
|
|
20778
|
+
handleToggleTexErrors = e => {
|
|
20780
20779
|
this.setState({
|
|
20781
20780
|
showErrors: !this.state.showErrors
|
|
20782
20781
|
});
|
|
@@ -20788,36 +20787,36 @@ class KatexErrorView extends React__namespace.Component {
|
|
|
20788
20787
|
const {
|
|
20789
20788
|
showErrors
|
|
20790
20789
|
} = this.state;
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
style:
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
}), "\xA0 KaTeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement("div", {
|
|
20805
|
-
className: aphrodite.css(styles$e.errorExplanation)
|
|
20806
|
-
}, "These errors will cause your LaTeX to load really slowly for the student. Please fix them if you can. If you can\u2019t because KaTeX doesn\u2019t support the feature you need, please message Cam."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement("div", {
|
|
20807
|
-
className: aphrodite.css(styles$e.error),
|
|
20790
|
+
const iconStyle = showErrors ? styles$e.iconExpanded : styles$e.iconCollapsed;
|
|
20791
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20792
|
+
style: styles$e.errorContainer
|
|
20793
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20794
|
+
style: styles$e.title,
|
|
20795
|
+
onClick: this.handleToggleTexErrors
|
|
20796
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
20797
|
+
icon: caretRight__default["default"],
|
|
20798
|
+
style: iconStyle
|
|
20799
|
+
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20800
|
+
style: styles$e.errorExplanation
|
|
20801
|
+
}, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20802
|
+
style: styles$e.error,
|
|
20808
20803
|
key: index
|
|
20809
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
20804
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20810
20805
|
style: {
|
|
20811
20806
|
color: "red"
|
|
20812
20807
|
}
|
|
20813
|
-
}, e.math), /*#__PURE__*/React__namespace.createElement(
|
|
20808
|
+
}, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
|
|
20814
20809
|
}
|
|
20815
20810
|
}
|
|
20816
20811
|
const styles$e = aphrodite.StyleSheet.create({
|
|
20817
20812
|
title: {
|
|
20818
20813
|
backgroundColor: "#eee",
|
|
20819
20814
|
fontSize: "1.25em",
|
|
20820
|
-
padding: "4px 10px"
|
|
20815
|
+
padding: "4px 10px",
|
|
20816
|
+
cursor: "pointer",
|
|
20817
|
+
display: "flex",
|
|
20818
|
+
flexDirection: "row",
|
|
20819
|
+
alignItems: "center"
|
|
20821
20820
|
},
|
|
20822
20821
|
errorContainer: {
|
|
20823
20822
|
border: "1px solid #ddd",
|
|
@@ -20829,6 +20828,13 @@ const styles$e = aphrodite.StyleSheet.create({
|
|
|
20829
20828
|
},
|
|
20830
20829
|
error: {
|
|
20831
20830
|
padding: "4px 10px"
|
|
20831
|
+
},
|
|
20832
|
+
iconCollapsed: {
|
|
20833
|
+
transition: ".15s"
|
|
20834
|
+
},
|
|
20835
|
+
iconExpanded: {
|
|
20836
|
+
transform: "rotate(90deg)",
|
|
20837
|
+
transition: ".15s"
|
|
20832
20838
|
}
|
|
20833
20839
|
});
|
|
20834
20840
|
|
|
@@ -20941,6 +20947,7 @@ class Editor extends React__namespace.Component {
|
|
|
20941
20947
|
}
|
|
20942
20948
|
|
|
20943
20949
|
// TODO(arun): This is a deprecated method, use the appropriate replacement
|
|
20950
|
+
// eslint-disable-next-line react/no-unsafe
|
|
20944
20951
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
20945
20952
|
if (this.props.content !== nextProps.content) {
|
|
20946
20953
|
this.setState({
|
|
@@ -21659,7 +21666,7 @@ class Editor extends React__namespace.Component {
|
|
|
21659
21666
|
};
|
|
21660
21667
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
21661
21668
|
className: "perseus-single-editor " + (this.props.className || "")
|
|
21662
|
-
}, textareaWrapper, katexErrorList.length > 0 && /*#__PURE__*/React__namespace.createElement(
|
|
21669
|
+
}, textareaWrapper, katexErrorList.length > 0 && /*#__PURE__*/React__namespace.createElement(TexErrorView, {
|
|
21663
21670
|
errorList: katexErrorList
|
|
21664
21671
|
}), this.props.warnNoPrompt && noPrompt && /*#__PURE__*/React__namespace.createElement("div", {
|
|
21665
21672
|
style: warningStyle
|
|
@@ -25842,6 +25849,8 @@ class BlurInput extends React__namespace.Component {
|
|
|
25842
25849
|
value: this.props.value
|
|
25843
25850
|
};
|
|
25844
25851
|
}
|
|
25852
|
+
|
|
25853
|
+
// eslint-disable-next-line react/no-unsafe
|
|
25845
25854
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
25846
25855
|
this.setState({
|
|
25847
25856
|
value: nextProps.value
|
|
@@ -26615,6 +26624,7 @@ const SortableArea = createReactClass__default["default"]({
|
|
|
26615
26624
|
componentDidMount: function () {
|
|
26616
26625
|
this._setDragEvents();
|
|
26617
26626
|
},
|
|
26627
|
+
// eslint-disable-next-line react/no-unsafe
|
|
26618
26628
|
UNSAFE_componentWillReceiveProps: function (nextProps) {
|
|
26619
26629
|
this.setState({
|
|
26620
26630
|
components: nextProps.components
|