@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @khanacademy/perseus-editor
|
|
2
2
|
|
|
3
|
+
## 2.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`45350a24`](https://github.com/Khan/perseus/commit/45350a2458cd3f816bc87af40997e426feb4b13b)]:
|
|
8
|
+
- @khanacademy/perseus@16.0.0
|
|
9
|
+
|
|
10
|
+
## 2.12.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#814](https://github.com/Khan/perseus/pull/814) [`105d2060`](https://github.com/Khan/perseus/commit/105d20603d935d35cff237b17f0bfb57ca751e4c) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Change KaTeXErrorView to TeXErrorView and adopt Phosphor Icons in it
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#814](https://github.com/Khan/perseus/pull/814) [`105d2060`](https://github.com/Khan/perseus/commit/105d20603d935d35cff237b17f0bfb57ca751e4c) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor build change to how we provide Typescript type definitions (should be no change to build output).
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`a91c84fe`](https://github.com/Khan/perseus/commit/a91c84fe53827ff4333220777a9918882b7fe9f0), [`3e176246`](https://github.com/Khan/perseus/commit/3e176246025ba237682569481dd9960f7a0dabf4), [`105d2060`](https://github.com/Khan/perseus/commit/105d20603d935d35cff237b17f0bfb57ca751e4c), [`3cf5ac4c`](https://github.com/Khan/perseus/commit/3cf5ac4c3f9d51dbcddc6f75bfbf0f8778b20f78)]:
|
|
21
|
+
- @khanacademy/perseus@15.0.0
|
|
22
|
+
- @khanacademy/perseus-core@1.4.0
|
|
23
|
+
- @khanacademy/kas@0.3.6
|
|
24
|
+
- @khanacademy/kmath@0.1.7
|
|
25
|
+
|
|
3
26
|
## 2.11.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/dist/es/index.js
CHANGED
|
@@ -10,11 +10,13 @@ import { StyleSheet, css } from 'aphrodite';
|
|
|
10
10
|
import $ from 'jquery';
|
|
11
11
|
import * as ReactDOM from 'react-dom';
|
|
12
12
|
import ReactDOM__default from 'react-dom';
|
|
13
|
+
import { View } from '@khanacademy/wonder-blocks-core';
|
|
14
|
+
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
15
|
+
import caretRight from '@phosphor-icons/core/bold/caret-right-bold.svg';
|
|
13
16
|
import classNames from 'classnames';
|
|
14
17
|
import { point, number, line, ray, vector } from '@khanacademy/kmath';
|
|
15
18
|
import * as KAS from '@khanacademy/kas';
|
|
16
19
|
import { isTruthy } from '@khanacademy/wonder-stuff-core';
|
|
17
|
-
import { View } from '@khanacademy/wonder-blocks-core';
|
|
18
20
|
import Spacing from '@khanacademy/wonder-blocks-spacing';
|
|
19
21
|
import * as Typography from '@khanacademy/wonder-blocks-typography';
|
|
20
22
|
import Button from '@khanacademy/wonder-blocks-button';
|
|
@@ -22,24 +24,21 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
|
|
|
22
24
|
|
|
23
25
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
24
26
|
const libName = "@khanacademy/perseus-editor";
|
|
25
|
-
const libVersion = "2.
|
|
27
|
+
const libVersion = "2.12.1";
|
|
26
28
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
27
29
|
|
|
28
30
|
function _extends() {
|
|
29
|
-
_extends = Object.assign
|
|
31
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
30
32
|
for (var i = 1; i < arguments.length; i++) {
|
|
31
33
|
var source = arguments[i];
|
|
32
|
-
|
|
33
34
|
for (var key in source) {
|
|
34
35
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
35
36
|
target[key] = source[key];
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
|
|
40
40
|
return target;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
42
|
return _extends.apply(this, arguments);
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -20629,6 +20628,8 @@ class WidgetEditor extends React.Component {
|
|
|
20629
20628
|
widgetInfo: _upgradeWidgetInfo(props)
|
|
20630
20629
|
};
|
|
20631
20630
|
}
|
|
20631
|
+
|
|
20632
|
+
// eslint-disable-next-line react/no-unsafe
|
|
20632
20633
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
20633
20634
|
// @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
|
|
20634
20635
|
this.setState({
|
|
@@ -20733,15 +20734,15 @@ class WidgetSelect extends React.Component {
|
|
|
20733
20734
|
}
|
|
20734
20735
|
|
|
20735
20736
|
/**
|
|
20736
|
-
* Displays a collapsable list of
|
|
20737
|
+
* Displays a collapsable list of TeX rendering errors.
|
|
20737
20738
|
*/
|
|
20738
|
-
class
|
|
20739
|
+
class TexErrorView extends React.Component {
|
|
20739
20740
|
constructor(...args) {
|
|
20740
20741
|
super(...args);
|
|
20741
20742
|
this.state = {
|
|
20742
20743
|
showErrors: false
|
|
20743
20744
|
};
|
|
20744
|
-
this.
|
|
20745
|
+
this.handleToggleTexErrors = e => {
|
|
20745
20746
|
this.setState({
|
|
20746
20747
|
showErrors: !this.state.showErrors
|
|
20747
20748
|
});
|
|
@@ -20754,42 +20755,36 @@ class KatexErrorView extends React.Component {
|
|
|
20754
20755
|
const {
|
|
20755
20756
|
showErrors
|
|
20756
20757
|
} = this.state;
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
style:
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
}), "\xA0 KaTeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement("div", {
|
|
20771
|
-
className: css(styles$e.errorExplanation)
|
|
20772
|
-
}, "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.createElement("div", {
|
|
20773
|
-
className: css(styles$e.error),
|
|
20758
|
+
const iconStyle = showErrors ? styles$e.iconExpanded : styles$e.iconCollapsed;
|
|
20759
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
20760
|
+
style: styles$e.errorContainer
|
|
20761
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
20762
|
+
style: styles$e.title,
|
|
20763
|
+
onClick: this.handleToggleTexErrors
|
|
20764
|
+
}, /*#__PURE__*/React.createElement(PhosphorIcon, {
|
|
20765
|
+
icon: caretRight,
|
|
20766
|
+
style: iconStyle
|
|
20767
|
+
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
|
|
20768
|
+
style: styles$e.errorExplanation
|
|
20769
|
+
}, "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.createElement(View, {
|
|
20770
|
+
style: styles$e.error,
|
|
20774
20771
|
key: index
|
|
20775
|
-
}, /*#__PURE__*/React.createElement(
|
|
20772
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
20776
20773
|
style: {
|
|
20777
20774
|
color: "red"
|
|
20778
20775
|
}
|
|
20779
|
-
}, e.math), /*#__PURE__*/React.createElement(
|
|
20776
|
+
}, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
|
|
20780
20777
|
}
|
|
20781
20778
|
}
|
|
20782
|
-
KatexErrorView.propTypes = {
|
|
20783
|
-
errorList: PropTypes.arrayOf(PropTypes.shape({
|
|
20784
|
-
math: PropTypes.string.isRequired,
|
|
20785
|
-
message: PropTypes.string.isRequired
|
|
20786
|
-
})).isRequired
|
|
20787
|
-
};
|
|
20788
20779
|
const styles$e = StyleSheet.create({
|
|
20789
20780
|
title: {
|
|
20790
20781
|
backgroundColor: "#eee",
|
|
20791
20782
|
fontSize: "1.25em",
|
|
20792
|
-
padding: "4px 10px"
|
|
20783
|
+
padding: "4px 10px",
|
|
20784
|
+
cursor: "pointer",
|
|
20785
|
+
display: "flex",
|
|
20786
|
+
flexDirection: "row",
|
|
20787
|
+
alignItems: "center"
|
|
20793
20788
|
},
|
|
20794
20789
|
errorContainer: {
|
|
20795
20790
|
border: "1px solid #ddd",
|
|
@@ -20801,6 +20796,13 @@ const styles$e = StyleSheet.create({
|
|
|
20801
20796
|
},
|
|
20802
20797
|
error: {
|
|
20803
20798
|
padding: "4px 10px"
|
|
20799
|
+
},
|
|
20800
|
+
iconCollapsed: {
|
|
20801
|
+
transition: ".15s"
|
|
20802
|
+
},
|
|
20803
|
+
iconExpanded: {
|
|
20804
|
+
transform: "rotate(90deg)",
|
|
20805
|
+
transition: ".15s"
|
|
20804
20806
|
}
|
|
20805
20807
|
});
|
|
20806
20808
|
|
|
@@ -21405,6 +21407,7 @@ class Editor extends React.Component {
|
|
|
21405
21407
|
}
|
|
21406
21408
|
|
|
21407
21409
|
// TODO(arun): This is a deprecated method, use the appropriate replacement
|
|
21410
|
+
// eslint-disable-next-line react/no-unsafe
|
|
21408
21411
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
21409
21412
|
if (this.props.content !== nextProps.content) {
|
|
21410
21413
|
this.setState({
|
|
@@ -21624,7 +21627,7 @@ class Editor extends React.Component {
|
|
|
21624
21627
|
};
|
|
21625
21628
|
return /*#__PURE__*/React.createElement("div", {
|
|
21626
21629
|
className: "perseus-single-editor " + (this.props.className || "")
|
|
21627
|
-
}, textareaWrapper, katexErrorList.length > 0 && /*#__PURE__*/React.createElement(
|
|
21630
|
+
}, textareaWrapper, katexErrorList.length > 0 && /*#__PURE__*/React.createElement(TexErrorView, {
|
|
21628
21631
|
errorList: katexErrorList
|
|
21629
21632
|
}), this.props.warnNoPrompt && noPrompt && /*#__PURE__*/React.createElement("div", {
|
|
21630
21633
|
style: warningStyle
|
|
@@ -24375,13 +24378,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
24375
24378
|
var target = {};
|
|
24376
24379
|
var sourceKeys = Object.keys(source);
|
|
24377
24380
|
var key, i;
|
|
24378
|
-
|
|
24379
24381
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
24380
24382
|
key = sourceKeys[i];
|
|
24381
24383
|
if (excluded.indexOf(key) >= 0) continue;
|
|
24382
24384
|
target[key] = source[key];
|
|
24383
24385
|
}
|
|
24384
|
-
|
|
24385
24386
|
return target;
|
|
24386
24387
|
}
|
|
24387
24388
|
|
|
@@ -25879,6 +25880,8 @@ class BlurInput extends React.Component {
|
|
|
25879
25880
|
value: this.props.value
|
|
25880
25881
|
};
|
|
25881
25882
|
}
|
|
25883
|
+
|
|
25884
|
+
// eslint-disable-next-line react/no-unsafe
|
|
25882
25885
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
25883
25886
|
this.setState({
|
|
25884
25887
|
value: nextProps.value
|
|
@@ -26606,6 +26609,7 @@ const SortableArea = createReactClass({
|
|
|
26606
26609
|
componentDidMount: function () {
|
|
26607
26610
|
this._setDragEvents();
|
|
26608
26611
|
},
|
|
26612
|
+
// eslint-disable-next-line react/no-unsafe
|
|
26609
26613
|
UNSAFE_componentWillReceiveProps: function (nextProps) {
|
|
26610
26614
|
this.setState({
|
|
26611
26615
|
components: nextProps.components
|