@khanacademy/math-input 17.1.0 → 17.2.1
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/es/index.js +32 -4
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.1
|
|
50
|
+
const libVersion = "17.2.1";
|
|
51
51
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
52
52
|
|
|
53
53
|
function _extends() {
|
|
@@ -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,
|
|
2153
|
+
this.props.onChange(value, () => {});
|
|
2140
2154
|
this._hideCursorHandle();
|
|
2141
2155
|
}
|
|
2142
2156
|
}
|
|
@@ -2371,10 +2385,22 @@ const IconAsset = function (_ref) {
|
|
|
2371
2385
|
fill: tintColor
|
|
2372
2386
|
}));
|
|
2373
2387
|
}
|
|
2388
|
+
case "Fractions":
|
|
2389
|
+
// The Fractions keypad is a special one that never displays anything
|
|
2390
|
+
// in the tabbar. Ideally, we'd separate the KeypadPageType from the
|
|
2391
|
+
// tab bar item types, but that's not easy given how the keypad manages
|
|
2392
|
+
// the selected page. For now, we'll just return a dummy SVG to satisfy
|
|
2393
|
+
// the types here.
|
|
2394
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
2395
|
+
width: "44",
|
|
2396
|
+
height: "44",
|
|
2397
|
+
viewBox: "0 0 44 44",
|
|
2398
|
+
fill: "none",
|
|
2399
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2400
|
+
});
|
|
2374
2401
|
default:
|
|
2375
2402
|
{
|
|
2376
|
-
|
|
2377
|
-
throw new Error("Invalid icon type");
|
|
2403
|
+
throw new Error(`Invalid icon type: ${type}`);
|
|
2378
2404
|
}
|
|
2379
2405
|
}
|
|
2380
2406
|
};
|