@khanacademy/math-input 20.0.3 → 20.1.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.
|
@@ -3,6 +3,7 @@ import { MathInputI18nContext } from "../i18n-context";
|
|
|
3
3
|
import type { KeypadAPI, KeypadContextType } from "../../types";
|
|
4
4
|
type Props = {
|
|
5
5
|
keypadElement?: KeypadAPI;
|
|
6
|
+
ariaLabel: string;
|
|
6
7
|
onBlur: () => void;
|
|
7
8
|
onChange: (value: string, callback: any) => void;
|
|
8
9
|
onFocus: () => void;
|
|
@@ -10,7 +10,7 @@ declare class MathWrapper {
|
|
|
10
10
|
mathField: MathFieldInterface;
|
|
11
11
|
callbacks: any;
|
|
12
12
|
mobileKeyTranslator: Record<Key, MathFieldUpdaterCallback>;
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(mathFieldMount: any, ariaLabel: string, strings: MathInputStrings, locale: string, callbacks?: {});
|
|
14
14
|
focus(): void;
|
|
15
15
|
blur(): void;
|
|
16
16
|
/**
|
package/dist/es/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import PropTypes from 'prop-types';
|
|
|
15
15
|
|
|
16
16
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
17
17
|
const libName = "@khanacademy/math-input";
|
|
18
|
-
const libVersion = "20.0
|
|
18
|
+
const libVersion = "20.1.0";
|
|
19
19
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
20
20
|
|
|
21
21
|
function _extends() {
|
|
@@ -1402,12 +1402,13 @@ const getKeyTranslator = locale => ({
|
|
|
1402
1402
|
* from MathQuill changes.
|
|
1403
1403
|
*/
|
|
1404
1404
|
class MathWrapper {
|
|
1405
|
-
constructor(
|
|
1405
|
+
constructor(mathFieldMount, ariaLabel, strings, locale, callbacks = {}) {
|
|
1406
|
+
var _this$mathField;
|
|
1406
1407
|
this.mathField = void 0;
|
|
1407
1408
|
// MathQuill MathField input
|
|
1408
1409
|
this.callbacks = void 0;
|
|
1409
1410
|
this.mobileKeyTranslator = void 0;
|
|
1410
|
-
this.mathField = createMathField(
|
|
1411
|
+
this.mathField = createMathField(mathFieldMount, locale, strings, () => {
|
|
1411
1412
|
return {
|
|
1412
1413
|
// use a span instead of a textarea so that we don't bring up the
|
|
1413
1414
|
// native keyboard on mobile when selecting the input
|
|
@@ -1416,6 +1417,7 @@ class MathWrapper {
|
|
|
1416
1417
|
}
|
|
1417
1418
|
};
|
|
1418
1419
|
});
|
|
1420
|
+
(_this$mathField = this.mathField) == null || _this$mathField.setAriaLabel(ariaLabel);
|
|
1419
1421
|
this.callbacks = callbacks;
|
|
1420
1422
|
this.mobileKeyTranslator = _extends({}, getKeyTranslator(locale), {
|
|
1421
1423
|
// note(Matthew): our mobile backspace logic is really complicated
|
|
@@ -2179,7 +2181,7 @@ class MathInput extends React.Component {
|
|
|
2179
2181
|
}
|
|
2180
2182
|
componentDidMount() {
|
|
2181
2183
|
this._isMounted = true;
|
|
2182
|
-
this.mathField = new MathWrapper(this._mathContainer, this.context.strings, this.context.locale, {
|
|
2184
|
+
this.mathField = new MathWrapper(this._mathContainer, this.props.ariaLabel, this.context.strings, this.context.locale, {
|
|
2183
2185
|
onCursorMove: cursor => {
|
|
2184
2186
|
// TODO(charlie): It's not great that there is so much coupling
|
|
2185
2187
|
// between this keypad and the input behavior. We should wrap
|