@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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @khanacademy/perseus-editor
2
2
 
3
+ ## 2.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#894](https://github.com/Khan/perseus/pull/894) [`49d5c821`](https://github.com/Khan/perseus/commit/49d5c821a2ad07aadf31f09f2814859de2c0f157) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Add a confirmation before deleting a configured widget in the Exercise Editor
8
+
9
+ * [#896](https://github.com/Khan/perseus/pull/896) [`04981063`](https://github.com/Khan/perseus/commit/049810636968afac5672f790896768338319810a) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Add a confirmation before deleting a hint in the Exercise Editor
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`a5479339`](https://github.com/Khan/perseus/commit/a547933946b8be33b388fa4654d87289734848f0)]:
14
+ - @khanacademy/perseus@17.8.0
15
+
3
16
  ## 2.16.2
4
17
 
5
18
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -25,7 +25,7 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
25
25
 
26
26
  // This file is processed by a Rollup plugin (replace) to inject the production
27
27
  const libName = "@khanacademy/perseus-editor";
28
- const libVersion = "2.16.2";
28
+ const libVersion = "2.17.0";
29
29
  addLibraryVersionToPerseusDebug(libName, libVersion);
30
30
 
31
31
  function _extends() {
@@ -20923,6 +20923,10 @@ class Editor extends React.Component {
20923
20923
  }, cb, silent);
20924
20924
  };
20925
20925
  this._handleWidgetEditorRemove = id => {
20926
+ // eslint-disable-next-line no-alert
20927
+ if (!confirm("Are you sure you want to delete this item?")) {
20928
+ return;
20929
+ }
20926
20930
  const textarea = this.textarea.current;
20927
20931
  const re = new RegExp(widgetRegExp.replace("{id}", id), "gm");
20928
20932
  this.props.onChange({
@@ -21456,6 +21460,8 @@ class Editor extends React.Component {
21456
21460
  widgets = {};
21457
21461
  underlayPieces = [];
21458
21462
  for (let i = 0; i < pieces.length; i++) {
21463
+ // We split on widgets so every even-numbered indexed piece is
21464
+ // text and odd-numbered indexes are the widget references.
21459
21465
  if (i % 2 === 0) {
21460
21466
  // Normal text
21461
21467
  underlayPieces.push(pieces[i]);
@@ -23658,6 +23664,10 @@ class CombinedHintsEditor extends React.Component {
23658
23664
  }, cb, silent);
23659
23665
  };
23660
23666
  this.handleHintRemove = i => {
23667
+ // eslint-disable-next-line no-alert
23668
+ if (!confirm("Are you sure you want to delete this hint?")) {
23669
+ return;
23670
+ }
23661
23671
  const hints = _(this.props.hints).clone();
23662
23672
  // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
23663
23673
  hints.splice(i, 1);