@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/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.12.0";
67
+ const libVersion = "2.13.0";
68
68
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
69
69
 
70
70
  function _extends() {
@@ -26772,12 +26772,12 @@ const SortableItem = createReactClass__default["default"]({
26772
26772
 
26773
26773
  const {
26774
26774
  InfoTip: InfoTip$j,
26775
- PropCheckBox: PropCheckBox$b,
26776
- TexButtons
26775
+ PropCheckBox: PropCheckBox$b
26777
26776
  } = perseus.components;
26778
26777
 
26779
26778
  // types for iterables
26780
26779
 
26780
+ const buttonSetsList = ["basic", "trig", "prealgebra", "logarithms", "basic relations", "advanced relations"];
26781
26781
  const parseAnswerKey = _ref => {
26782
26782
  let {
26783
26783
  key
@@ -26819,31 +26819,6 @@ class ExpressionEditor extends React__namespace.Component {
26819
26819
  buttonSets: ["basic"],
26820
26820
  functions: ["f", "g", "h"]
26821
26821
  };
26822
- constructor(props) {
26823
- super(props);
26824
- // Is the format of `value` TeX or plain text?
26825
- // TODO(alex): Remove after backfilling everything to TeX
26826
- // TODO(joel) - sucks if you edit some expression without
26827
- // backslashes or curly braces, then come back to the question and
26828
- // it's surprisingly not TeX anymore.
26829
-
26830
- let isTex;
26831
- // default to TeX if new;
26832
- if (props.answerForms.length === 0) {
26833
- isTex = true;
26834
- } else {
26835
- isTex = props.answerForms.some(form => {
26836
- const {
26837
- value
26838
- } = form;
26839
- // only TeX has backslashes and curly braces
26840
- return value.indexOf("\\") !== -1 || value.indexOf("{") !== -1;
26841
- });
26842
- }
26843
- this.state = {
26844
- isTex
26845
- };
26846
- }
26847
26822
  change() {
26848
26823
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26849
26824
  args[_key] = arguments[_key];
@@ -26884,14 +26859,13 @@ class ExpressionEditor extends React__namespace.Component {
26884
26859
  });
26885
26860
 
26886
26861
  // checkboxes to choose which sets of input buttons are shown
26887
- const buttonSetChoices = Object.keys(TexButtons.buttonSets).map(name => {
26862
+ const buttonSetChoices = buttonSetsList.map(name => {
26888
26863
  // The first one gets special cased to always be checked, disabled,
26889
26864
  // and float left.
26890
26865
  const isFirst = name === "basic";
26891
26866
  const checked = this.props.buttonSets.includes(name) || isFirst;
26892
- const className = isFirst ? "button-set-label-float" : "button-set-label";
26893
26867
  return /*#__PURE__*/React__namespace.createElement("label", {
26894
- className: className,
26868
+ className: "button-set-label",
26895
26869
  key: name
26896
26870
  }, /*#__PURE__*/React__namespace.createElement("input", {
26897
26871
  type: "checkbox",
@@ -26904,7 +26878,8 @@ class ExpressionEditor extends React__namespace.Component {
26904
26878
  TeX
26905
26879
  } = perseus.Dependencies.getDependencies(); // OldExpression only
26906
26880
 
26907
- buttonSetChoices.splice(1, 1, /*#__PURE__*/React__namespace.createElement("label", {
26881
+ buttonSetChoices.unshift( /*#__PURE__*/React__namespace.createElement("label", {
26882
+ className: "button-set-label",
26908
26883
  key: "show-div"
26909
26884
  }, /*#__PURE__*/React__namespace.createElement("input", {
26910
26885
  type: "checkbox",
@@ -26925,12 +26900,7 @@ class ExpressionEditor extends React__namespace.Component {
26925
26900
  type: "text",
26926
26901
  defaultValue: this.props.functions.join(" "),
26927
26902
  onChange: this.handleFunctions
26928
- })), /*#__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, {
26929
- className: "math-input-buttons",
26930
- sets: this.props.buttonSets,
26931
- convertDotToTimes: this.props.times,
26932
- onInsert: this.handleTexInsert
26933
- }), /*#__PURE__*/React__namespace.createElement("h3", {
26903
+ })), /*#__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), /*#__PURE__*/React__namespace.createElement("h3", {
26934
26904
  className: "expression-editor-h3"
26935
26905
  }, "Answers"), /*#__PURE__*/React__namespace.createElement("p", {
26936
26906
  style: {
@@ -27040,7 +27010,7 @@ class ExpressionEditor extends React__namespace.Component {
27040
27010
 
27041
27011
  // called when the selected buttonset changes
27042
27012
  handleButtonSet = changingName => {
27043
- const buttonSetNames = Object.keys(TexButtons.buttonSets);
27013
+ const buttonSetNames = buttonSetsList;
27044
27014
 
27045
27015
  // Filter to preserve order - using .union and .difference would always
27046
27016
  // move the last added button set to the end.