@khanacademy/perseus-editor 2.16.2 → 2.17.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/CHANGELOG.md +13 -0
- package/dist/es/index.js +11 -1
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/editor.test.tsx +120 -98
- package/src/__tests__/hint-editor.test.tsx +83 -0
- package/src/editor.tsx +7 -0
- package/src/hint-editor.tsx +5 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
|
|
|
64
64
|
|
|
65
65
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
66
66
|
const libName = "@khanacademy/perseus-editor";
|
|
67
|
-
const libVersion = "2.
|
|
67
|
+
const libVersion = "2.17.0";
|
|
68
68
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
69
69
|
|
|
70
70
|
function _extends() {
|
|
@@ -21024,6 +21024,10 @@ class Editor extends React__namespace.Component {
|
|
|
21024
21024
|
}, cb, silent);
|
|
21025
21025
|
};
|
|
21026
21026
|
_handleWidgetEditorRemove = id => {
|
|
21027
|
+
// eslint-disable-next-line no-alert
|
|
21028
|
+
if (!confirm("Are you sure you want to delete this item?")) {
|
|
21029
|
+
return;
|
|
21030
|
+
}
|
|
21027
21031
|
const textarea = this.textarea.current;
|
|
21028
21032
|
const re = new RegExp(widgetRegExp.replace("{id}", id), "gm");
|
|
21029
21033
|
this.props.onChange({
|
|
@@ -21494,6 +21498,8 @@ class Editor extends React__namespace.Component {
|
|
|
21494
21498
|
widgets = {};
|
|
21495
21499
|
underlayPieces = [];
|
|
21496
21500
|
for (let i = 0; i < pieces.length; i++) {
|
|
21501
|
+
// We split on widgets so every even-numbered indexed piece is
|
|
21502
|
+
// text and odd-numbered indexes are the widget references.
|
|
21497
21503
|
if (i % 2 === 0) {
|
|
21498
21504
|
// Normal text
|
|
21499
21505
|
underlayPieces.push(pieces[i]);
|
|
@@ -23653,6 +23659,10 @@ class CombinedHintsEditor extends React__namespace.Component {
|
|
|
23653
23659
|
}, cb, silent);
|
|
23654
23660
|
};
|
|
23655
23661
|
handleHintRemove = i => {
|
|
23662
|
+
// eslint-disable-next-line no-alert
|
|
23663
|
+
if (!confirm("Are you sure you want to delete this hint?")) {
|
|
23664
|
+
return;
|
|
23665
|
+
}
|
|
23656
23666
|
const hints = ___default["default"](this.props.hints).clone();
|
|
23657
23667
|
// @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
|
|
23658
23668
|
hints.splice(i, 1);
|