@khanacademy/perseus-editor 2.0.1 → 2.0.2
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 +7 -0
- package/dist/es/index.js +9 -48
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +9 -48
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/article-editor.tsx +0 -1
- package/src/components/dropdown-option.tsx +0 -8
- package/src/diffs/text-diff.tsx +0 -1
- package/src/diffs/widget-diff.tsx +0 -2
- package/src/editor.tsx +0 -1
- package/src/multirenderer-editor.tsx +2 -20
- package/src/widgets/__stories__/label-image-editor.stories.tsx +0 -3
- package/src/widgets/__stories__/radio-editor.stories.tsx +0 -1
- package/src/widgets/categorizer-editor.tsx +0 -1
- package/src/widgets/cs-program-editor.tsx +0 -2
- package/src/widgets/expression-editor.tsx +0 -2
- package/src/widgets/grapher-editor.tsx +0 -1
- package/src/widgets/iframe-editor.tsx +0 -2
- package/src/widgets/input-number-editor.tsx +0 -1
- package/src/widgets/interaction-editor.tsx +0 -1
- package/src/widgets/interactive-graph-editor.tsx +0 -1
- package/src/widgets/label-image/marker.tsx +0 -1
- package/src/widgets/transformer-editor.tsx +0 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -1056,7 +1056,6 @@ class Editor extends React__namespace.Component {
|
|
|
1056
1056
|
}, function () {
|
|
1057
1057
|
perseus.Util.textarea.moveCursor(
|
|
1058
1058
|
// findDOMNode can return Text but we know this is Element
|
|
1059
|
-
// $FlowFixMe[incompatible-call]
|
|
1060
1059
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
|
|
1061
1060
|
textarea,
|
|
1062
1061
|
// We want to put the cursor after the widget
|
|
@@ -1901,7 +1900,6 @@ class ArticleEditor extends React__namespace.Component {
|
|
|
1901
1900
|
}
|
|
1902
1901
|
_defineProperty(ArticleEditor, "defaultProps", {
|
|
1903
1902
|
contentPaths: [],
|
|
1904
|
-
// $FlowFixMe[incompatible-exact]
|
|
1905
1903
|
json: [{}],
|
|
1906
1904
|
mode: "edit",
|
|
1907
1905
|
screen: "desktop",
|
|
@@ -4610,7 +4608,7 @@ class ModeDropdown extends React__namespace.Component {
|
|
|
4610
4608
|
_defineProperty(this, "_handleSelectMode", event => {
|
|
4611
4609
|
if (this.props.onChange) {
|
|
4612
4610
|
// event.target.value corresponds to the options' values below which
|
|
4613
|
-
// are limited to EditorMode, but
|
|
4611
|
+
// are limited to EditorMode, but TypeScript doesn't know that so we have
|
|
4614
4612
|
// to cast through any here.
|
|
4615
4613
|
const value = event.target.value;
|
|
4616
4614
|
this.props.onChange(value);
|
|
@@ -4846,7 +4844,7 @@ const NodeContent = props => {
|
|
|
4846
4844
|
|
|
4847
4845
|
// All uses of `data` have been cast through any which isn't safe. This was
|
|
4848
4846
|
// done to avoid introducing new logic which may have resulted in a change
|
|
4849
|
-
// of behavior. Also, there doesn't appear to be a way to tell
|
|
4847
|
+
// of behavior. Also, there doesn't appear to be a way to tell TypeScript the
|
|
4850
4848
|
// difference between and `TagsNode` and `ItemArrayNode`, see
|
|
4851
4849
|
// perseus-all-package/multi-items/item-types.js.
|
|
4852
4850
|
if (shape.type === "content") {
|
|
@@ -4925,12 +4923,6 @@ const withStickiness = WrappedComponent => {
|
|
|
4925
4923
|
render() {
|
|
4926
4924
|
return (
|
|
4927
4925
|
/*#__PURE__*/
|
|
4928
|
-
/**
|
|
4929
|
-
* $FlowFixMe[incompatible-exact]
|
|
4930
|
-
* TODO(somewhatabstract, JIRA-XXXX):
|
|
4931
|
-
* Cannot create WrappedComponent element because inexact props
|
|
4932
|
-
* [1] is incompatible with exact WithStickiness [2].
|
|
4933
|
-
*/
|
|
4934
4926
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
|
|
4935
4927
|
React__namespace.createElement(WrappedComponent, _extends({}, this.props, {
|
|
4936
4928
|
sticky: this.state.sticky
|
|
@@ -4959,9 +4951,6 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
4959
4951
|
className: aphrodite.css(sticky && styles$c.sticky)
|
|
4960
4952
|
},
|
|
4961
4953
|
/*#__PURE__*/
|
|
4962
|
-
// $FlowFixMe[incompatible-exact]: {...data} pass too many props
|
|
4963
|
-
// $FlowFixMe[incompatible-type]
|
|
4964
|
-
// $FlowFixMe[prop-missing]
|
|
4965
4954
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
4966
4955
|
React__namespace.createElement(Editor, _extends({}, data, {
|
|
4967
4956
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
@@ -5065,10 +5054,7 @@ const ArrayNodeContent = props => {
|
|
|
5065
5054
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
5066
5055
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
5067
5056
|
className: aphrodite.css(styles$c.verticalFlip)
|
|
5068
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconChevronDown)))),
|
|
5069
|
-
// $FlowFixMe[unsafe-addition]
|
|
5070
|
-
// $FlowFixMe[prop-missing]
|
|
5071
|
-
i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
5057
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
5072
5058
|
key: "moveArrayElementDown",
|
|
5073
5059
|
className: aphrodite.css(styles$c.control)
|
|
5074
5060
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
@@ -5705,14 +5691,10 @@ class PairEditor$1 extends React__namespace.Component {
|
|
|
5705
5691
|
return /*#__PURE__*/React__namespace.createElement("fieldset", {
|
|
5706
5692
|
className: "pair-editor"
|
|
5707
5693
|
}, /*#__PURE__*/React__namespace.createElement("label", null, "Name:", " ", /*#__PURE__*/React__namespace.createElement(BlurInput, {
|
|
5708
|
-
value: this.props.name
|
|
5709
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
5710
|
-
,
|
|
5694
|
+
value: this.props.name,
|
|
5711
5695
|
onChange: this.change("name")
|
|
5712
5696
|
})), /*#__PURE__*/React__namespace.createElement("label", null, " ", "Value:", " ", /*#__PURE__*/React__namespace.createElement(BlurInput, {
|
|
5713
|
-
value: this.props.value
|
|
5714
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
5715
|
-
,
|
|
5697
|
+
value: this.props.value,
|
|
5716
5698
|
onChange: this.change("value")
|
|
5717
5699
|
})));
|
|
5718
5700
|
}
|
|
@@ -6869,10 +6851,7 @@ class ExpressionEditor extends React__namespace.Component {
|
|
|
6869
6851
|
})), /*#__PURE__*/React__namespace.createElement(InfoTip$j, null, /*#__PURE__*/React__namespace.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, "Button sets:"), buttonSetChoices), this.state.isTex && /*#__PURE__*/React__namespace.createElement(TexButtons, {
|
|
6870
6852
|
className: "math-input-buttons",
|
|
6871
6853
|
sets: this.props.buttonSets,
|
|
6872
|
-
convertDotToTimes: this.props.times
|
|
6873
|
-
// onInsert is typed as `(string | ((input: $FlowFixMe) => void)) => void`
|
|
6874
|
-
// $FlowFixMe[incompatible-type]
|
|
6875
|
-
,
|
|
6854
|
+
convertDotToTimes: this.props.times,
|
|
6876
6855
|
onInsert: this.handleTexInsert
|
|
6877
6856
|
}), /*#__PURE__*/React__namespace.createElement("h3", {
|
|
6878
6857
|
className: "expression-editor-h3"
|
|
@@ -7775,7 +7754,6 @@ class GrapherEditor extends React__namespace.Component {
|
|
|
7775
7754
|
// NOTE(jeremy): This editor doesn't pass in a bunch of
|
|
7776
7755
|
// standard props that the Renderer provides normally (eg.
|
|
7777
7756
|
// alignment, findWidgets, etc).
|
|
7778
|
-
// $FlowFixMe[prop-missing]
|
|
7779
7757
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
7780
7758
|
React__namespace.createElement(Grapher, _extends({}, graphProps, {
|
|
7781
7759
|
apiOptions: this.props.apiOptions,
|
|
@@ -7915,14 +7893,10 @@ class PairEditor extends React__namespace.Component {
|
|
|
7915
7893
|
}
|
|
7916
7894
|
render() {
|
|
7917
7895
|
return /*#__PURE__*/React__namespace.createElement("fieldset", null, /*#__PURE__*/React__namespace.createElement("label", null, "Name:", /*#__PURE__*/React__namespace.createElement(BlurInput, {
|
|
7918
|
-
value: this.props.name
|
|
7919
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
7920
|
-
,
|
|
7896
|
+
value: this.props.name,
|
|
7921
7897
|
onChange: this.change("name")
|
|
7922
7898
|
})), /*#__PURE__*/React__namespace.createElement("label", null, "Value:", /*#__PURE__*/React__namespace.createElement(BlurInput, {
|
|
7923
|
-
value: this.props.value
|
|
7924
|
-
// $FlowFixMe[incompatible-type] single-param call returns a callback
|
|
7925
|
-
,
|
|
7899
|
+
value: this.props.value,
|
|
7926
7900
|
onChange: this.change("value")
|
|
7927
7901
|
})));
|
|
7928
7902
|
}
|
|
@@ -8409,9 +8383,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
8409
8383
|
disabled: !this.props.inexact,
|
|
8410
8384
|
defaultValue: this.props.maxError,
|
|
8411
8385
|
onBlur: e => {
|
|
8412
|
-
const ans = "" + (
|
|
8413
|
-
// $FlowFixMe[incompatible-type]
|
|
8414
|
-
perseus.Util.firstNumericalParse(e.target.value) || 0);
|
|
8386
|
+
const ans = "" + (perseus.Util.firstNumericalParse(e.target.value) || 0);
|
|
8415
8387
|
e.target.value = ans;
|
|
8416
8388
|
this.props.onChange({
|
|
8417
8389
|
maxError: ans
|
|
@@ -9812,7 +9784,6 @@ const InteractiveGraphEditor = createReactClass__default["default"]({
|
|
|
9812
9784
|
// There are a bunch of props that renderer.jsx passes to widgets via
|
|
9813
9785
|
// getWidgetProps() and widget-container.jsx that the editors don't
|
|
9814
9786
|
// bother passing.
|
|
9815
|
-
// $FlowFixMe[prop-missing]
|
|
9816
9787
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
9817
9788
|
React__namespace.createElement(InteractiveGraph, _extends({}, graphProps, {
|
|
9818
9789
|
containerSizeClass: sizeClass,
|
|
@@ -10713,9 +10684,6 @@ class Option extends React__namespace.Component {
|
|
|
10713
10684
|
ariaLabel
|
|
10714
10685
|
} = this.props;
|
|
10715
10686
|
return /*#__PURE__*/React__namespace.createElement("button", {
|
|
10716
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
10717
|
-
// "node (null) This type is incompatible with this.node (HTMLDivElement)"
|
|
10718
|
-
// $FlowFixMe[incompatible-type](0.52.0->0.53.0)
|
|
10719
10687
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
|
|
10720
10688
|
ref: node => this.node = node,
|
|
10721
10689
|
value: value,
|
|
@@ -10726,11 +10694,6 @@ class Option extends React__namespace.Component {
|
|
|
10726
10694
|
,
|
|
10727
10695
|
onClick: value => {
|
|
10728
10696
|
if (!disabled && onClick) {
|
|
10729
|
-
// TODO(mdr): We found a new Flow error here when upgrading
|
|
10730
|
-
// from 0.35.0 to 0.52.0: "value (unused function
|
|
10731
|
-
// argument)". This comment was automatically added to
|
|
10732
|
-
// this file, to suppress the error for now. Please
|
|
10733
|
-
// consider fixing!
|
|
10734
10697
|
// @ts-expect-error [FEI-5003] - TS2554 - Expected 0 arguments, but got 1.
|
|
10735
10698
|
onClick(value);
|
|
10736
10699
|
}
|
|
@@ -10991,7 +10954,6 @@ class Marker extends React__namespace.Component {
|
|
|
10991
10954
|
}), /*#__PURE__*/React__namespace.createElement(OptionGroup, {
|
|
10992
10955
|
onSelected: this.handleSelectAnswer
|
|
10993
10956
|
// TODO(WB-1096): make selectedValues immutable in wonder-blocks
|
|
10994
|
-
// $FlowFixMe[incompatible-type]
|
|
10995
10957
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
10996
10958
|
,
|
|
10997
10959
|
selectedValues: answers
|
|
@@ -14815,7 +14777,6 @@ class TransformationsShapeEditor extends React__namespace.Component {
|
|
|
14815
14777
|
});
|
|
14816
14778
|
_defineProperty(this, "updateCoords", () => {
|
|
14817
14779
|
this.props.onChange({
|
|
14818
|
-
// $FlowFixMe[prop-missing]
|
|
14819
14780
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
|
|
14820
14781
|
shape: this.shape.toJSON()
|
|
14821
14782
|
});
|