@khanacademy/math-input 17.0.8 → 17.2.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
@@ -47,7 +47,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
47
47
 
48
48
  // This file is processed by a Rollup plugin (replace) to inject the production
49
49
  const libName = "@khanacademy/math-input";
50
- const libVersion = "17.0.8";
50
+ const libVersion = "17.2.0";
51
51
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
52
52
 
53
53
  function _extends() {
@@ -424,9 +424,9 @@ const createBaseConfig = () => ({
424
424
  // Most of these autoOperatorNames are simply the MathQuill defaults.
425
425
  // We have to list them all in order to add the `sen` operator (see
426
426
  // comment below).
427
- autoOperatorNames: ["arccos", "arcsin", "arctan", "arg", "cos", "cosh", "cot", "coth", "csc", "deg", "det", "dim", "exp", "gcd", "hom", "inf", "ker", "lg", "lim", "liminf", "limsup", "ln", "log", "max", "min", "Pr", "projlim", "sec",
427
+ autoOperatorNames: ["arccos", "arcsin", "arctan", "arctg", "arg", "cos", "cosec", "cossec", "cosh", "cot", "cotg", "coth", "csc", "ctg", "deg", "det", "dim", "exp", "gcd", "hom", "inf", "ker", "lg", "lim", "liminf", "limsup", "ln", "log", "max", "min", "Pr", "projlim", "sec",
428
428
  // sen is used instead of sin in e.g. Portuguese
429
- "sen", "sin", "sinh", "sup", "tan", "tanh"].join(" "),
429
+ "sen", "sin", "sinh", "sup", "tan", "tanh", "tg"].join(" "),
430
430
  // Pop the cursor out of super/subscripts on arithmetic operators
431
431
  // or (in)equalities.
432
432
  charsThatBreakOutOfSupSub: "+-*/=<>≠≤≥",
@@ -1946,6 +1946,13 @@ class MathInput extends React__namespace.Component {
1946
1946
  if (!this.state.focused) {
1947
1947
  this.focus();
1948
1948
  }
1949
+
1950
+ // If the user clicked on the input using a mouse or tap gesture,
1951
+ // we want to set the focus to the inputRef so that the keyUp
1952
+ // event will be triggered when the user types on the keyboard.
1953
+ // This is necessary to support Chromebooks as they use mobile user
1954
+ // agents, do not simulate touch events, and have physical keyboards.
1955
+ this.inputRef?.focus();
1949
1956
  };
1950
1957
 
1951
1958
  // We want to allow the user to be able to focus the input via click
@@ -1977,6 +1984,13 @@ class MathInput extends React__namespace.Component {
1977
1984
  if (!this.state.focused) {
1978
1985
  this.focus();
1979
1986
  }
1987
+
1988
+ // If the user clicked on the input using a mouse or tap gesture,
1989
+ // we want to set the focus to the inputRef so that the keyUp
1990
+ // event will be triggered when the user types on the keyboard.
1991
+ // This is necessary to support Chromebooks as they use mobile user
1992
+ // agents, do not simulate touch events, and have physical keyboards.
1993
+ this.inputRef?.focus();
1980
1994
  };
1981
1995
  handleTouchMove = e => {
1982
1996
  e.stopPropagation();
@@ -2136,7 +2150,7 @@ class MathInput extends React__namespace.Component {
2136
2150
  const value = this.mathField.getContent();
2137
2151
  if (this.props.value !== value) {
2138
2152
  this.mathField.setContent(this.props.value);
2139
- this.props.onChange(value, false);
2153
+ this.props.onChange(value, () => {});
2140
2154
  this._hideCursorHandle();
2141
2155
  }
2142
2156
  }