@khanacademy/perseus-editor 7.0.3 → 8.0.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/dist/es/index.js +31 -11
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
|
|
|
81
81
|
|
|
82
82
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
83
83
|
const libName = "@khanacademy/perseus-editor";
|
|
84
|
-
const libVersion = "
|
|
84
|
+
const libVersion = "8.0.0";
|
|
85
85
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
86
86
|
|
|
87
87
|
function _extends() {
|
|
@@ -21430,7 +21430,7 @@ class Editor extends React__namespace.Component {
|
|
|
21430
21430
|
} else if (templateType === "allWidgets") {
|
|
21431
21431
|
template = perseus.Widgets.getAllWidgetTypes().map(type => `[[${perseus.Util.snowman} ${type} 1]]`).join("\n\n");
|
|
21432
21432
|
} else {
|
|
21433
|
-
throw new
|
|
21433
|
+
throw new perseusCore.PerseusError("Invalid template type: " + templateType, perseusCore.Errors.InvalidInput, {
|
|
21434
21434
|
metadata: {
|
|
21435
21435
|
templateType
|
|
21436
21436
|
}
|
|
@@ -22090,7 +22090,7 @@ class ArticleEditor extends React__namespace.Component {
|
|
|
22090
22090
|
if (this.props.mode === "preview" || this.props.mode === "json") {
|
|
22091
22091
|
return this.props.json;
|
|
22092
22092
|
}
|
|
22093
|
-
throw new
|
|
22093
|
+
throw new perseusCore.PerseusError("Could not serialize; mode " + this.props.mode + " not found", perseusCore.Errors.Internal);
|
|
22094
22094
|
}
|
|
22095
22095
|
|
|
22096
22096
|
/**
|
|
@@ -22103,7 +22103,7 @@ class ArticleEditor extends React__namespace.Component {
|
|
|
22103
22103
|
if (this.props.mode !== "edit") {
|
|
22104
22104
|
// TODO(joshuan): We should be able to get save warnings in
|
|
22105
22105
|
// preview mode.
|
|
22106
|
-
throw new
|
|
22106
|
+
throw new perseusCore.PerseusError("Can only get save warnings in edit mode.", perseusCore.Errors.NotAllowed);
|
|
22107
22107
|
}
|
|
22108
22108
|
return this._sections().map((section, i) => {
|
|
22109
22109
|
// eslint-disable-next-line react/no-string-refs
|
|
@@ -25888,7 +25888,7 @@ class CSProgramEditor extends React__namespace.Component {
|
|
|
25888
25888
|
programType: programType
|
|
25889
25889
|
});
|
|
25890
25890
|
}).fail((jqxhr, textStatus, error) => {
|
|
25891
|
-
perseus.Log.error("Error retrieving scratchpad info for program ID ",
|
|
25891
|
+
perseus.Log.error("Error retrieving scratchpad info for program ID ", perseusCore.Errors.TransientService, {
|
|
25892
25892
|
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'.
|
|
25893
25893
|
cause: error,
|
|
25894
25894
|
loggedMetadata: {
|
|
@@ -34546,9 +34546,14 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34546
34546
|
onChange: this.props.onChange
|
|
34547
34547
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "A coefficient style number allows the student to use - for -1 and an empty string to mean 1."))));
|
|
34548
34548
|
const addAnswerButton = /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("a", {
|
|
34549
|
-
href: "
|
|
34549
|
+
href: "#",
|
|
34550
34550
|
className: "simple-button orange",
|
|
34551
|
-
onClick:
|
|
34551
|
+
onClick: e => {
|
|
34552
|
+
// preventDefault ensures that href="#"
|
|
34553
|
+
// doesn't scroll to the top of the page
|
|
34554
|
+
e.preventDefault();
|
|
34555
|
+
this.addAnswer();
|
|
34556
|
+
},
|
|
34552
34557
|
onKeyDown: e => this.onSpace(e, this.addAnswer)
|
|
34553
34558
|
}, /*#__PURE__*/React__namespace.createElement("span", null, "Add new answer")));
|
|
34554
34559
|
const instructions = {
|
|
@@ -34630,21 +34635,36 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34630
34635
|
})) : null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
34631
34636
|
className: "value-divider"
|
|
34632
34637
|
}), /*#__PURE__*/React__namespace.createElement("a", {
|
|
34633
|
-
href: "
|
|
34638
|
+
href: "#",
|
|
34634
34639
|
className: "answer-status " + answer.status,
|
|
34635
|
-
onClick:
|
|
34640
|
+
onClick: e => {
|
|
34641
|
+
// preventDefault ensures that href="#"
|
|
34642
|
+
// doesn't scroll to the top of the page
|
|
34643
|
+
e.preventDefault();
|
|
34644
|
+
this.onStatusChange(i);
|
|
34645
|
+
},
|
|
34636
34646
|
onKeyDown: e => this.onSpace(e, this.onStatusChange)
|
|
34637
34647
|
}, answer.status), /*#__PURE__*/React__namespace.createElement("a", {
|
|
34638
|
-
href: "
|
|
34648
|
+
href: "#",
|
|
34639
34649
|
className: "answer-trash",
|
|
34640
34650
|
"aria-label": "Delete answer",
|
|
34641
|
-
onClick:
|
|
34651
|
+
onClick: e => {
|
|
34652
|
+
// preventDefault ensures that href="#"
|
|
34653
|
+
// doesn't scroll to the top of the page
|
|
34654
|
+
e.preventDefault();
|
|
34655
|
+
this.onTrashAnswer(i);
|
|
34656
|
+
},
|
|
34642
34657
|
onKeyDown: e => this.onSpace(e, this.onTrashAnswer)
|
|
34643
34658
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconTrash$1)), /*#__PURE__*/React__namespace.createElement("a", {
|
|
34644
|
-
href: "
|
|
34659
|
+
href: "#",
|
|
34645
34660
|
className: "options-toggle",
|
|
34646
34661
|
"aria-label": "Toggle options",
|
|
34647
|
-
onClick:
|
|
34662
|
+
onClick: e => {
|
|
34663
|
+
// preventDefault ensures that href="#"
|
|
34664
|
+
// doesn't scroll to the top of the page
|
|
34665
|
+
e.preventDefault();
|
|
34666
|
+
this.onToggleOptions(i);
|
|
34667
|
+
},
|
|
34648
34668
|
onKeyDown: e => this.onSpace(e, this.onToggleOptions)
|
|
34649
34669
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconGear))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
34650
34670
|
className: "input-answer-editor-message"
|