@khanacademy/perseus-editor 2.12.0 → 2.13.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,23 @@
1
1
  # @khanacademy/perseus-editor
2
2
 
3
+ ## 2.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#838](https://github.com/Khan/perseus/pull/838) [`233fc9fc`](https://github.com/Khan/perseus/commit/233fc9fcd4c65d2ff0c8f1ebd1cb1b17b76cbe0c) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove TexButtons and update ExpressionEditor
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`2e2f2cc1`](https://github.com/Khan/perseus/commit/2e2f2cc1afe99613eb688ab1e4e1fccad0c8df57), [`204788f8`](https://github.com/Khan/perseus/commit/204788f8f583bda5ff94d74fd70ec542fedd3d6e), [`233fc9fc`](https://github.com/Khan/perseus/commit/233fc9fcd4c65d2ff0c8f1ebd1cb1b17b76cbe0c)]:
12
+ - @khanacademy/perseus@17.0.0
13
+
14
+ ## 2.12.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`45350a24`](https://github.com/Khan/perseus/commit/45350a2458cd3f816bc87af40997e426feb4b13b)]:
19
+ - @khanacademy/perseus@16.0.0
20
+
3
21
  ## 2.12.0
4
22
 
5
23
  ### Minor Changes
package/dist/es/index.js CHANGED
@@ -24,7 +24,7 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
24
24
 
25
25
  // This file is processed by a Rollup plugin (replace) to inject the production
26
26
  const libName = "@khanacademy/perseus-editor";
27
- const libVersion = "2.12.0";
27
+ const libVersion = "2.13.0";
28
28
  addLibraryVersionToPerseusDebug(libName, libVersion);
29
29
 
30
30
  function _extends() {
@@ -26757,12 +26757,12 @@ const SortableItem = createReactClass({
26757
26757
 
26758
26758
  const {
26759
26759
  InfoTip: InfoTip$j,
26760
- PropCheckBox: PropCheckBox$b,
26761
- TexButtons
26760
+ PropCheckBox: PropCheckBox$b
26762
26761
  } = components;
26763
26762
 
26764
26763
  // types for iterables
26765
26764
 
26765
+ const buttonSetsList = ["basic", "trig", "prealgebra", "logarithms", "basic relations", "advanced relations"];
26766
26766
  const parseAnswerKey = ({
26767
26767
  key
26768
26768
  }) => {
@@ -26796,13 +26796,8 @@ const _makeNewKey = answerForms => {
26796
26796
  return usedKeys.length;
26797
26797
  };
26798
26798
  class ExpressionEditor extends React.Component {
26799
- constructor(_props) {
26800
- super(_props);
26801
- // Is the format of `value` TeX or plain text?
26802
- // TODO(alex): Remove after backfilling everything to TeX
26803
- // TODO(joel) - sucks if you edit some expression without
26804
- // backslashes or curly braces, then come back to the question and
26805
- // it's surprisingly not TeX anymore.
26799
+ constructor(...args) {
26800
+ super(...args);
26806
26801
  this.serialize = () => {
26807
26802
  const formSerializables = ["value", "form", "simplify", "considered",
26808
26803
  // it's a little weird to serialize the react key, but saves some
@@ -26896,7 +26891,7 @@ class ExpressionEditor extends React.Component {
26896
26891
  };
26897
26892
  // called when the selected buttonset changes
26898
26893
  this.handleButtonSet = changingName => {
26899
- const buttonSetNames = Object.keys(TexButtons.buttonSets);
26894
+ const buttonSetNames = buttonSetsList;
26900
26895
 
26901
26896
  // Filter to preserve order - using .union and .difference would always
26902
26897
  // move the last added button set to the end.
@@ -26936,22 +26931,6 @@ class ExpressionEditor extends React.Component {
26936
26931
  newProps.functions = e.target.value.split(/[ ,]+/).filter(isTruthy);
26937
26932
  this.props.onChange(newProps);
26938
26933
  };
26939
- let isTex;
26940
- // default to TeX if new;
26941
- if (_props.answerForms.length === 0) {
26942
- isTex = true;
26943
- } else {
26944
- isTex = _props.answerForms.some(form => {
26945
- const {
26946
- value
26947
- } = form;
26948
- // only TeX has backslashes and curly braces
26949
- return value.indexOf("\\") !== -1 || value.indexOf("{") !== -1;
26950
- });
26951
- }
26952
- this.state = {
26953
- isTex
26954
- };
26955
26934
  }
26956
26935
  change(...args) {
26957
26936
  return Changeable.change.apply(this, args);
@@ -26993,14 +26972,13 @@ class ExpressionEditor extends React.Component {
26993
26972
  });
26994
26973
 
26995
26974
  // checkboxes to choose which sets of input buttons are shown
26996
- const buttonSetChoices = Object.keys(TexButtons.buttonSets).map(name => {
26975
+ const buttonSetChoices = buttonSetsList.map(name => {
26997
26976
  // The first one gets special cased to always be checked, disabled,
26998
26977
  // and float left.
26999
26978
  const isFirst = name === "basic";
27000
26979
  const checked = this.props.buttonSets.includes(name) || isFirst;
27001
- const className = isFirst ? "button-set-label-float" : "button-set-label";
27002
26980
  return /*#__PURE__*/React.createElement("label", {
27003
- className: className,
26981
+ className: "button-set-label",
27004
26982
  key: name
27005
26983
  }, /*#__PURE__*/React.createElement("input", {
27006
26984
  type: "checkbox",
@@ -27013,7 +26991,8 @@ class ExpressionEditor extends React.Component {
27013
26991
  TeX
27014
26992
  } = Dependencies.getDependencies(); // OldExpression only
27015
26993
 
27016
- buttonSetChoices.splice(1, 1, /*#__PURE__*/React.createElement("label", {
26994
+ buttonSetChoices.unshift( /*#__PURE__*/React.createElement("label", {
26995
+ className: "button-set-label",
27017
26996
  key: "show-div"
27018
26997
  }, /*#__PURE__*/React.createElement("input", {
27019
26998
  type: "checkbox",
@@ -27034,12 +27013,7 @@ class ExpressionEditor extends React.Component {
27034
27013
  type: "text",
27035
27014
  defaultValue: this.props.functions.join(" "),
27036
27015
  onChange: this.handleFunctions
27037
- })), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.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.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Button sets:"), buttonSetChoices), this.state.isTex && /*#__PURE__*/React.createElement(TexButtons, {
27038
- className: "math-input-buttons",
27039
- sets: this.props.buttonSets,
27040
- convertDotToTimes: this.props.times,
27041
- onInsert: this.handleTexInsert
27042
- }), /*#__PURE__*/React.createElement("h3", {
27016
+ })), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.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.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Button sets:"), buttonSetChoices), /*#__PURE__*/React.createElement("h3", {
27043
27017
  className: "expression-editor-h3"
27044
27018
  }, "Answers"), /*#__PURE__*/React.createElement("p", {
27045
27019
  style: {