@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/es/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
|
|
|
17
17
|
|
|
18
18
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
19
19
|
const libName = "@khanacademy/math-input";
|
|
20
|
-
const libVersion = "17.1
|
|
20
|
+
const libVersion = "17.2.1";
|
|
21
21
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
22
22
|
|
|
23
23
|
function _extends() {
|
|
@@ -1757,6 +1757,7 @@ class MathInput extends React.Component {
|
|
|
1757
1757
|
});
|
|
1758
1758
|
};
|
|
1759
1759
|
this.handleTouchStart = (e, keypadActive, setKeypadActive) => {
|
|
1760
|
+
var _this$inputRef;
|
|
1760
1761
|
e.stopPropagation();
|
|
1761
1762
|
|
|
1762
1763
|
// Hide the cursor handle on touch start, if the handle itself isn't
|
|
@@ -1784,11 +1785,19 @@ class MathInput extends React.Component {
|
|
|
1784
1785
|
if (!this.state.focused) {
|
|
1785
1786
|
this.focus();
|
|
1786
1787
|
}
|
|
1788
|
+
|
|
1789
|
+
// If the user clicked on the input using a mouse or tap gesture,
|
|
1790
|
+
// we want to set the focus to the inputRef so that the keyUp
|
|
1791
|
+
// event will be triggered when the user types on the keyboard.
|
|
1792
|
+
// This is necessary to support Chromebooks as they use mobile user
|
|
1793
|
+
// agents, do not simulate touch events, and have physical keyboards.
|
|
1794
|
+
(_this$inputRef = this.inputRef) == null || _this$inputRef.focus();
|
|
1787
1795
|
};
|
|
1788
1796
|
// We want to allow the user to be able to focus the input via click
|
|
1789
1797
|
// when using ChromeOS third-party browsers that use mobile user agents,
|
|
1790
1798
|
// but don't actually simulate touch events.
|
|
1791
1799
|
this.handleClick = (e, keypadActive, setKeypadActive) => {
|
|
1800
|
+
var _this$inputRef2;
|
|
1792
1801
|
e.stopPropagation();
|
|
1793
1802
|
|
|
1794
1803
|
// Hide the cursor handle on click
|
|
@@ -1814,6 +1823,13 @@ class MathInput extends React.Component {
|
|
|
1814
1823
|
if (!this.state.focused) {
|
|
1815
1824
|
this.focus();
|
|
1816
1825
|
}
|
|
1826
|
+
|
|
1827
|
+
// If the user clicked on the input using a mouse or tap gesture,
|
|
1828
|
+
// we want to set the focus to the inputRef so that the keyUp
|
|
1829
|
+
// event will be triggered when the user types on the keyboard.
|
|
1830
|
+
// This is necessary to support Chromebooks as they use mobile user
|
|
1831
|
+
// agents, do not simulate touch events, and have physical keyboards.
|
|
1832
|
+
(_this$inputRef2 = this.inputRef) == null || _this$inputRef2.focus();
|
|
1817
1833
|
};
|
|
1818
1834
|
this.handleTouchMove = e => {
|
|
1819
1835
|
e.stopPropagation();
|
|
@@ -1969,7 +1985,7 @@ class MathInput extends React.Component {
|
|
|
1969
1985
|
const value = this.mathField.getContent();
|
|
1970
1986
|
if (this.props.value !== value) {
|
|
1971
1987
|
this.mathField.setContent(this.props.value);
|
|
1972
|
-
this.props.onChange(value,
|
|
1988
|
+
this.props.onChange(value, () => {});
|
|
1973
1989
|
this._hideCursorHandle();
|
|
1974
1990
|
}
|
|
1975
1991
|
}
|
|
@@ -2336,10 +2352,22 @@ const IconAsset = function IconAsset({
|
|
|
2336
2352
|
fill: tintColor
|
|
2337
2353
|
}));
|
|
2338
2354
|
}
|
|
2355
|
+
case "Fractions":
|
|
2356
|
+
// The Fractions keypad is a special one that never displays anything
|
|
2357
|
+
// in the tabbar. Ideally, we'd separate the KeypadPageType from the
|
|
2358
|
+
// tab bar item types, but that's not easy given how the keypad manages
|
|
2359
|
+
// the selected page. For now, we'll just return a dummy SVG to satisfy
|
|
2360
|
+
// the types here.
|
|
2361
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
2362
|
+
width: "44",
|
|
2363
|
+
height: "44",
|
|
2364
|
+
viewBox: "0 0 44 44",
|
|
2365
|
+
fill: "none",
|
|
2366
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2367
|
+
});
|
|
2339
2368
|
default:
|
|
2340
2369
|
{
|
|
2341
|
-
|
|
2342
|
-
throw new Error("Invalid icon type");
|
|
2370
|
+
throw new Error(`Invalid icon type: ${type}`);
|
|
2343
2371
|
}
|
|
2344
2372
|
}
|
|
2345
2373
|
};
|