@pie-lib/math-input 6.6.1-next.45 → 6.6.1-next.506
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/CHANGELOG.json +60 -0
- package/CHANGELOG.md +140 -0
- package/lib/horizontal-keypad.js +33 -38
- package/lib/horizontal-keypad.js.map +1 -1
- package/lib/index.js +12 -7
- package/lib/index.js.map +1 -1
- package/lib/keypad/index.js +119 -71
- package/lib/keypad/index.js.map +1 -1
- package/lib/keypad/keys-layout.js +5 -1
- package/lib/keypad/keys-layout.js.map +1 -1
- package/lib/keys/basic-operators.js +1 -1
- package/lib/keys/basic-operators.js.map +1 -1
- package/lib/keys/chars.js +1 -1
- package/lib/keys/chars.js.map +1 -1
- package/lib/keys/comparison.js +7 -5
- package/lib/keys/comparison.js.map +1 -1
- package/lib/keys/constants.js +17 -1
- package/lib/keys/constants.js.map +1 -1
- package/lib/keys/digits.js +2 -2
- package/lib/keys/digits.js.map +1 -1
- package/lib/keys/edit.js.map +1 -1
- package/lib/keys/exponent.js +1 -1
- package/lib/keys/exponent.js.map +1 -1
- package/lib/keys/fractions.js +1 -1
- package/lib/keys/fractions.js.map +1 -1
- package/lib/keys/geometry.js +35 -7
- package/lib/keys/geometry.js.map +1 -1
- package/lib/keys/grades.js +122 -37
- package/lib/keys/grades.js.map +1 -1
- package/lib/keys/index.js +7 -3
- package/lib/keys/index.js.map +1 -1
- package/lib/keys/log.js +2 -2
- package/lib/keys/log.js.map +1 -1
- package/lib/keys/logic.js +1 -1
- package/lib/keys/logic.js.map +1 -1
- package/lib/keys/matrices.js +1 -1
- package/lib/keys/matrices.js.map +1 -1
- package/lib/keys/misc.js +1 -1
- package/lib/keys/misc.js.map +1 -1
- package/lib/keys/navigation.js.map +1 -1
- package/lib/keys/operators.js.map +1 -1
- package/lib/keys/statistics.js +8 -1
- package/lib/keys/statistics.js.map +1 -1
- package/lib/keys/sub-sup.js +1 -1
- package/lib/keys/sub-sup.js.map +1 -1
- package/lib/keys/trigonometry.js +1 -1
- package/lib/keys/trigonometry.js.map +1 -1
- package/lib/keys/utils.js +11 -17
- package/lib/keys/utils.js.map +1 -1
- package/lib/keys/vars.js +1 -1
- package/lib/keys/vars.js.map +1 -1
- package/lib/math-input.js +39 -47
- package/lib/math-input.js.map +1 -1
- package/lib/mq/custom-elements.js.map +1 -1
- package/lib/mq/index.js +2 -2
- package/lib/mq/index.js.map +1 -1
- package/lib/mq/input.js +67 -40
- package/lib/mq/input.js.map +1 -1
- package/lib/mq/static.js +26 -34
- package/lib/mq/static.js.map +1 -1
- package/package.json +3 -3
- package/src/horizontal-keypad.jsx +4 -1
- package/src/keypad/index.jsx +97 -11
- package/src/keys/constants.js +16 -0
- package/src/keys/geometry.js +26 -2
- package/src/keys/grades.js +198 -84
- package/src/keys/log.js +1 -1
- package/src/keys/statistics.js +7 -0
- package/src/mq/input.jsx +35 -0
package/src/keypad/index.jsx
CHANGED
|
@@ -40,14 +40,17 @@ const LatexButton = withStyles(theme => ({
|
|
|
40
40
|
width: '30px',
|
|
41
41
|
marginTop: '0 !important',
|
|
42
42
|
borderTop: '2px solid black',
|
|
43
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
44
|
+
|
|
43
45
|
'&.mq-arrow-both': {
|
|
46
|
+
top: '5px !important',
|
|
44
47
|
'& *': {
|
|
45
48
|
lineHeight: '1 !important'
|
|
46
49
|
},
|
|
47
50
|
'&:before': {
|
|
48
51
|
fontSize: '80%',
|
|
49
52
|
left: 'calc(-13%)',
|
|
50
|
-
top: '-0.
|
|
53
|
+
top: '-0.31em'
|
|
51
54
|
},
|
|
52
55
|
'&:after': {
|
|
53
56
|
fontSize: '80% !important',
|
|
@@ -57,12 +60,12 @@ const LatexButton = withStyles(theme => ({
|
|
|
57
60
|
'&.mq-empty:before': {
|
|
58
61
|
fontSize: '80%',
|
|
59
62
|
left: 'calc(-13%)',
|
|
60
|
-
top: '-0.
|
|
63
|
+
top: '-0.26em'
|
|
61
64
|
},
|
|
62
65
|
'&.mq-empty:after': {
|
|
63
66
|
fontSize: '80%',
|
|
64
67
|
right: 'calc(-13%)',
|
|
65
|
-
top: '-0.
|
|
68
|
+
top: '-0.26em'
|
|
66
69
|
},
|
|
67
70
|
'&.mq-empty': {
|
|
68
71
|
minHeight: '1.4em'
|
|
@@ -71,7 +74,7 @@ const LatexButton = withStyles(theme => ({
|
|
|
71
74
|
'&.mq-arrow-right:before': {
|
|
72
75
|
fontSize: '80%',
|
|
73
76
|
right: 'calc(-13%)',
|
|
74
|
-
top: '-0.
|
|
77
|
+
top: '-0.26em'
|
|
75
78
|
},
|
|
76
79
|
'& .mq-overarrow-inner': {
|
|
77
80
|
border: 'none !important'
|
|
@@ -104,10 +107,28 @@ const LatexButton = withStyles(theme => ({
|
|
|
104
107
|
},
|
|
105
108
|
'& .mq-parallelogram': {
|
|
106
109
|
lineHeight: 0.85
|
|
110
|
+
},
|
|
111
|
+
'& .mq-overarc': {
|
|
112
|
+
borderTop: '2px solid black !important',
|
|
113
|
+
'& .mq-overline-inner': {
|
|
114
|
+
borderTop: 'none !important',
|
|
115
|
+
paddingTop: '0 !important'
|
|
116
|
+
}
|
|
107
117
|
}
|
|
108
118
|
},
|
|
109
119
|
parallelButton: {
|
|
110
120
|
fontStyle: 'italic'
|
|
121
|
+
},
|
|
122
|
+
leftRightArrowButton: {
|
|
123
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
124
|
+
'& .mq-overline-inner': {
|
|
125
|
+
borderTop: 'none !important',
|
|
126
|
+
paddingTop: '0 !important'
|
|
127
|
+
},
|
|
128
|
+
'&:after': {
|
|
129
|
+
top: '-1.94em !important'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
111
132
|
}
|
|
112
133
|
}))(props => {
|
|
113
134
|
let buttonClass;
|
|
@@ -118,9 +139,29 @@ const LatexButton = withStyles(theme => ({
|
|
|
118
139
|
props.mqClassName,
|
|
119
140
|
props.classes.parallelButton
|
|
120
141
|
);
|
|
142
|
+
} else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
|
|
143
|
+
buttonClass = classNames(
|
|
144
|
+
props.classes.latexButton,
|
|
145
|
+
props.mqClassName,
|
|
146
|
+
props.classes.leftRightArrowButton
|
|
147
|
+
);
|
|
121
148
|
} else {
|
|
122
149
|
buttonClass = classNames(props.classes.latexButton, props.mqClassName);
|
|
123
150
|
}
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
const MQ = MathQuill.getInterface(2);
|
|
154
|
+
const span = document.createElement('span');
|
|
155
|
+
span.innerHTML = '';
|
|
156
|
+
const mathField = MQ.StaticMath(span);
|
|
157
|
+
|
|
158
|
+
mathField.parseLatex(props.latex);
|
|
159
|
+
mathField.latex(props.latex);
|
|
160
|
+
} catch (e) {
|
|
161
|
+
// received latex has errors - do not create button
|
|
162
|
+
return <></>;
|
|
163
|
+
}
|
|
164
|
+
|
|
124
165
|
return (
|
|
125
166
|
<Button className={classNames(props.classes.root, props.className)} onClick={props.onClick}>
|
|
126
167
|
<mq.Static className={buttonClass} latex={props.latex} />
|
|
@@ -128,15 +169,29 @@ const LatexButton = withStyles(theme => ({
|
|
|
128
169
|
);
|
|
129
170
|
});
|
|
130
171
|
|
|
172
|
+
const createCustomLayout = layoutObj => {
|
|
173
|
+
if (layoutObj) {
|
|
174
|
+
return {
|
|
175
|
+
gridTemplateColumns: `repeat(${layoutObj.columns}, minmax(min-content, 150px))`,
|
|
176
|
+
gridTemplateRows: `repeat(${layoutObj.rows}, minmax(40px, 60px))`,
|
|
177
|
+
gridAutoFlow: 'initial'
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {};
|
|
182
|
+
};
|
|
183
|
+
|
|
131
184
|
export class KeyPad extends React.Component {
|
|
132
185
|
static propTypes = {
|
|
133
186
|
classes: PropTypes.object.isRequired,
|
|
134
187
|
className: PropTypes.string,
|
|
135
188
|
baseSet: PropTypes.array,
|
|
136
189
|
additionalKeys: PropTypes.array,
|
|
190
|
+
layoutForKeyPad: PropTypes.object,
|
|
137
191
|
onPress: PropTypes.func.isRequired,
|
|
138
192
|
onFocus: PropTypes.func,
|
|
139
|
-
noDecimal: PropTypes.bool
|
|
193
|
+
noDecimal: PropTypes.bool,
|
|
194
|
+
mode: PropTypes.string
|
|
140
195
|
};
|
|
141
196
|
static defaultProps = {
|
|
142
197
|
baseSet: baseSet,
|
|
@@ -168,17 +223,42 @@ export class KeyPad extends React.Component {
|
|
|
168
223
|
};
|
|
169
224
|
|
|
170
225
|
render() {
|
|
171
|
-
const {
|
|
226
|
+
const {
|
|
227
|
+
classes,
|
|
228
|
+
className,
|
|
229
|
+
baseSet,
|
|
230
|
+
additionalKeys,
|
|
231
|
+
layoutForKeyPad,
|
|
232
|
+
onFocus,
|
|
233
|
+
mode
|
|
234
|
+
} = this.props;
|
|
172
235
|
|
|
173
|
-
const
|
|
236
|
+
const noBaseSet = [
|
|
237
|
+
'non-negative-integers',
|
|
238
|
+
'integers',
|
|
239
|
+
'decimals',
|
|
240
|
+
'fractions',
|
|
241
|
+
'item-authoring',
|
|
242
|
+
'language'
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
const keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
246
|
+
const allKeys = keysWithoutBaseSet
|
|
247
|
+
? this.flowKeys([], additionalKeys || [])
|
|
248
|
+
: this.flowKeys(baseSet, additionalKeys || []); //, ...sortKeys(additionalKeys)];
|
|
174
249
|
|
|
175
250
|
const shift = allKeys.length % 5 ? 1 : 0;
|
|
176
251
|
const style = {
|
|
177
252
|
gridTemplateColumns: `repeat(${Math.floor(allKeys.length / 5) +
|
|
178
|
-
shift}, minmax(min-content, 150px))
|
|
253
|
+
shift}, minmax(min-content, 150px))`,
|
|
254
|
+
...createCustomLayout(layoutForKeyPad)
|
|
179
255
|
};
|
|
180
256
|
return (
|
|
181
|
-
<div
|
|
257
|
+
<div
|
|
258
|
+
className={classNames(classes.keys, className, classes[mode])}
|
|
259
|
+
style={style}
|
|
260
|
+
onFocus={onFocus}
|
|
261
|
+
>
|
|
182
262
|
{allKeys.map((k, index) => {
|
|
183
263
|
const onClick = this.buttonClick.bind(this, k);
|
|
184
264
|
|
|
@@ -190,12 +270,15 @@ export class KeyPad extends React.Component {
|
|
|
190
270
|
onClick,
|
|
191
271
|
className: classNames(
|
|
192
272
|
classes.labelButton,
|
|
193
|
-
classes[k.category],
|
|
273
|
+
!keysWithoutBaseSet && classes[k.category],
|
|
274
|
+
classes[k.extraClass],
|
|
194
275
|
k.label === ',' && classes.comma,
|
|
195
276
|
k.label === '.' && classes.dot
|
|
196
277
|
),
|
|
197
278
|
disabled: this.keyIsNotAllowed(k),
|
|
198
|
-
key: `${k.label || k.latex || k.command}-${index}
|
|
279
|
+
key: `${k.label || k.latex || k.command}-${index}`,
|
|
280
|
+
...(k.actions || {}),
|
|
281
|
+
...(k.extraProps || {})
|
|
199
282
|
};
|
|
200
283
|
|
|
201
284
|
if (k.latex) {
|
|
@@ -231,6 +314,9 @@ const styles = theme => ({
|
|
|
231
314
|
gridColumnGap: '0px',
|
|
232
315
|
gridAutoFlow: 'column'
|
|
233
316
|
},
|
|
317
|
+
character: {
|
|
318
|
+
textTransform: 'initial !important'
|
|
319
|
+
},
|
|
234
320
|
holder: {
|
|
235
321
|
position: 'relative',
|
|
236
322
|
width: '100%',
|
package/src/keys/constants.js
CHANGED
|
@@ -17,3 +17,19 @@ export const eulers = set({
|
|
|
17
17
|
command: 'e',
|
|
18
18
|
category: 'constants'
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
export const infinity = set({
|
|
22
|
+
name: 'Infinity',
|
|
23
|
+
label: '\\infty',
|
|
24
|
+
latex: '\\infty',
|
|
25
|
+
command: '\\infty',
|
|
26
|
+
category: 'constants'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const halfInfinity = set({
|
|
30
|
+
name: 'Half Infinity',
|
|
31
|
+
label: '\\propto',
|
|
32
|
+
latex: '\\propto',
|
|
33
|
+
command: '\\propto',
|
|
34
|
+
category: 'constants'
|
|
35
|
+
});
|
package/src/keys/geometry.js
CHANGED
|
@@ -14,7 +14,7 @@ export const overRightArrow = set({
|
|
|
14
14
|
|
|
15
15
|
export const overLeftRightArrow = set({
|
|
16
16
|
name: 'Overline',
|
|
17
|
-
latex: '\\overleftrightarrow{}',
|
|
17
|
+
latex: '\\overleftrightarrow{\\overline{}}', // used this notation to display the pink box
|
|
18
18
|
symbol: 'AB',
|
|
19
19
|
command: '\\overleftrightarrow'
|
|
20
20
|
});
|
|
@@ -51,7 +51,7 @@ export const angle = set({
|
|
|
51
51
|
});
|
|
52
52
|
export const overArc = set({
|
|
53
53
|
name: 'Over arc',
|
|
54
|
-
latex: '\\overarc{}',
|
|
54
|
+
latex: '\\overarc{\\overline{}}', // used this notation to display the pink box
|
|
55
55
|
command: '\\overarc'
|
|
56
56
|
});
|
|
57
57
|
export const measureOfAngle = set({
|
|
@@ -66,6 +66,12 @@ export const triangle = set({
|
|
|
66
66
|
command: '\\triangle'
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
+
export const square = set({
|
|
70
|
+
name: 'Square',
|
|
71
|
+
latex: '\\square',
|
|
72
|
+
command: '\\square'
|
|
73
|
+
});
|
|
74
|
+
|
|
69
75
|
export const parallelogram = set({
|
|
70
76
|
name: 'Parallelogram',
|
|
71
77
|
latex: '\\parallelogram',
|
|
@@ -114,3 +120,21 @@ export const doublePrimeArcSecond = set({
|
|
|
114
120
|
latex: '"',
|
|
115
121
|
write: '"'
|
|
116
122
|
});
|
|
123
|
+
|
|
124
|
+
export const leftArrow = set({
|
|
125
|
+
name: 'Left Arrow',
|
|
126
|
+
latex: '\\leftarrow',
|
|
127
|
+
command: '\\leftarrow'
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const rightArrow = set({
|
|
131
|
+
name: 'Right Arrow',
|
|
132
|
+
latex: '\\rightarrow',
|
|
133
|
+
command: '\\rightarrow'
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export const leftrightArrow = set({
|
|
137
|
+
name: 'Left Right Arrow',
|
|
138
|
+
latex: '\\leftrightarrow',
|
|
139
|
+
command: '\\leftrightarrow'
|
|
140
|
+
});
|
package/src/keys/grades.js
CHANGED
|
@@ -14,18 +14,27 @@ import * as basicOperators from './basic-operators';
|
|
|
14
14
|
import * as matrices from './matrices';
|
|
15
15
|
import digits from './digits';
|
|
16
16
|
import * as logic from './logic';
|
|
17
|
+
import * as nav from './navigation';
|
|
18
|
+
import * as edit from './edit';
|
|
17
19
|
|
|
18
20
|
const hs = [
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
[fractions.blankOverBlank, misc.percentage, vars.x, exponent.squared, exponent.squareRoot],
|
|
22
|
+
[operators.circleDot, vars.y, subSup.subscript, exponent.xToPowerOfN, exponent.nthRoot],
|
|
23
|
+
[
|
|
24
|
+
misc.plusMinus,
|
|
25
|
+
comparison.lessThan,
|
|
26
|
+
comparison.greaterThan,
|
|
27
|
+
comparison.lessThanEqual,
|
|
28
|
+
comparison.greaterThanEqual
|
|
29
|
+
],
|
|
30
|
+
[constants.pi, vars.theta, misc.parenthesis, misc.brackets, misc.absValue],
|
|
31
|
+
[misc.notEqual, trigonometry.sin, trigonometry.cos, trigonometry.tan, geometry.degree]
|
|
24
32
|
];
|
|
25
33
|
|
|
26
34
|
const advancedAlgebra = (() => {
|
|
27
35
|
const out = [...hs.map(arr => [...arr])];
|
|
28
36
|
|
|
37
|
+
out[0].push({ name: 'i', latex: 'i', write: 'i' });
|
|
29
38
|
out[1].push(log.log);
|
|
30
39
|
out[2].push(log.logSubscript);
|
|
31
40
|
out[3].push(log.ln);
|
|
@@ -35,10 +44,11 @@ const advancedAlgebra = (() => {
|
|
|
35
44
|
|
|
36
45
|
const statisticsSet = (() => {
|
|
37
46
|
const out = [...hs.map(arr => [...arr])];
|
|
38
|
-
out[
|
|
39
|
-
out[
|
|
40
|
-
out[
|
|
41
|
-
out[
|
|
47
|
+
out[0].push(statistics.mu);
|
|
48
|
+
out[1].push(statistics.xBar);
|
|
49
|
+
out[2].push(statistics.yBar);
|
|
50
|
+
out[3].push(statistics.sigma);
|
|
51
|
+
out[4].push(statistics.smallSigma);
|
|
42
52
|
return out;
|
|
43
53
|
})();
|
|
44
54
|
|
|
@@ -54,109 +64,148 @@ export const gradeSets = [
|
|
|
54
64
|
{
|
|
55
65
|
predicate: n => n >= 6 && n <= 7,
|
|
56
66
|
set: [
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
67
|
+
[geometry.degree, comparison.lessThan, comparison.greaterThan],
|
|
68
|
+
[operators.circleDot, comparison.lessThanEqual, comparison.greaterThanEqual],
|
|
69
|
+
[vars.x, vars.y, exponent.squared, exponent.xToPowerOfN],
|
|
70
|
+
[misc.plusMinus, fractions.xOverBlank, fractions.xBlankBlank, exponent.squareRoot],
|
|
71
|
+
[constants.pi, misc.parenthesis, misc.absValue, exponent.nthRoot]
|
|
62
72
|
]
|
|
63
73
|
},
|
|
64
74
|
{
|
|
65
75
|
predicate: n => n >= 8 || n === 'HS',
|
|
76
|
+
set: hs
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
predicate: 'non-negative-integers',
|
|
66
80
|
set: [
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
[digits.seven, digits.eight, digits.nine],
|
|
82
|
+
[digits.four, digits.five, digits.six],
|
|
83
|
+
[digits.one, digits.two, digits.three],
|
|
84
|
+
[digits.zero, { name: '', latex: '', write: '' }, { name: '', latex: '', write: '' }],
|
|
85
|
+
[nav.left, nav.right, edit.del]
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
predicate: 'integers',
|
|
90
|
+
set: [
|
|
91
|
+
[digits.seven, digits.eight, digits.nine],
|
|
92
|
+
[digits.four, digits.five, digits.six],
|
|
93
|
+
[digits.one, digits.two, digits.three],
|
|
94
|
+
[digits.zero, { name: '', latex: '', write: '' }, basicOperators.minus],
|
|
95
|
+
[nav.left, nav.right, edit.del]
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
predicate: 'decimals',
|
|
100
|
+
set: [
|
|
101
|
+
[digits.seven, digits.eight, digits.nine],
|
|
102
|
+
[digits.four, digits.five, digits.six],
|
|
103
|
+
[digits.one, digits.two, digits.three],
|
|
104
|
+
[digits.zero, digits.decimalPoint, basicOperators.minus],
|
|
105
|
+
[nav.left, nav.right, edit.del]
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
predicate: 'fractions',
|
|
110
|
+
set: [
|
|
111
|
+
[digits.seven, digits.eight, digits.nine],
|
|
112
|
+
[digits.four, digits.five, digits.six],
|
|
113
|
+
[digits.one, digits.two, digits.three],
|
|
114
|
+
[digits.zero, fractions.blankOverBlank, basicOperators.minus],
|
|
115
|
+
[nav.left, nav.right, edit.del]
|
|
84
116
|
]
|
|
85
117
|
},
|
|
86
118
|
{
|
|
87
119
|
predicate: 'geometry',
|
|
88
120
|
set: [
|
|
89
121
|
[
|
|
122
|
+
fractions.blankOverBlank,
|
|
90
123
|
geometry.degree,
|
|
91
124
|
geometry.primeArcminute,
|
|
92
125
|
geometry.doublePrimeArcSecond,
|
|
93
|
-
geometry.
|
|
94
|
-
|
|
126
|
+
geometry.congruentTo,
|
|
127
|
+
geometry.similarTo
|
|
95
128
|
],
|
|
96
129
|
[
|
|
130
|
+
operators.circleDot,
|
|
97
131
|
geometry.angle,
|
|
98
132
|
geometry.measureOfAngle,
|
|
99
|
-
geometry.
|
|
100
|
-
geometry.
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
[trigonometry.sin, trigonometry.cos, trigonometry.tan, trigonometry.sec, exponent.nthRoot],
|
|
104
|
-
[trigonometry.csc, trigonometry.cot, exponent.xToPowerOfN, constants.pi, subSup.subscript],
|
|
105
|
-
[
|
|
106
|
-
geometry.overline,
|
|
107
|
-
geometry.overRightArrow,
|
|
108
|
-
geometry.overLeftRightArrow,
|
|
109
|
-
geometry.overArc,
|
|
110
|
-
vars.theta
|
|
111
|
-
]
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
predicate: 'miscellaneous',
|
|
116
|
-
set: [
|
|
117
|
-
[
|
|
118
|
-
subSup.superscript,
|
|
119
|
-
subSup.subscript,
|
|
120
|
-
fractions.blankOverBlank,
|
|
121
|
-
misc.percentage,
|
|
122
|
-
geometry.segment,
|
|
123
|
-
geometry.parallel
|
|
133
|
+
geometry.triangle,
|
|
134
|
+
geometry.notCongruentTo,
|
|
135
|
+
misc.notSimilar
|
|
124
136
|
],
|
|
125
137
|
[
|
|
138
|
+
trigonometry.sin,
|
|
139
|
+
trigonometry.cos,
|
|
140
|
+
trigonometry.tan,
|
|
141
|
+
constants.pi,
|
|
126
142
|
exponent.squareRoot,
|
|
127
|
-
exponent.nthRoot
|
|
128
|
-
misc.absValue,
|
|
129
|
-
misc.parenthesis,
|
|
130
|
-
geometry.perpindicular,
|
|
131
|
-
geometry.angle
|
|
143
|
+
exponent.nthRoot
|
|
132
144
|
],
|
|
133
145
|
[
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
],
|
|
141
|
-
[
|
|
142
|
-
misc.nApprox,
|
|
143
|
-
misc.notEqual,
|
|
144
|
-
geometry.congruentTo,
|
|
145
|
-
geometry.notCongruentTo,
|
|
146
|
-
geometry.parallelogram,
|
|
147
|
-
geometry.circledDot
|
|
146
|
+
trigonometry.csc,
|
|
147
|
+
trigonometry.sec,
|
|
148
|
+
trigonometry.cot,
|
|
149
|
+
vars.theta,
|
|
150
|
+
subSup.subscript,
|
|
151
|
+
exponent.xToPowerOfN
|
|
148
152
|
],
|
|
149
153
|
[
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
geometry.overline,
|
|
155
|
+
geometry.overRightArrow,
|
|
156
|
+
geometry.overLeftRightArrow,
|
|
157
|
+
geometry.overArc,
|
|
158
|
+
geometry.perpindicular,
|
|
159
|
+
geometry.parallel
|
|
156
160
|
]
|
|
157
161
|
]
|
|
158
162
|
},
|
|
159
163
|
// {
|
|
164
|
+
// predicate: 'miscellaneous',
|
|
165
|
+
// set: [
|
|
166
|
+
// [
|
|
167
|
+
// subSup.superscript,
|
|
168
|
+
// subSup.subscript,
|
|
169
|
+
// fractions.blankOverBlank,
|
|
170
|
+
// misc.percentage,
|
|
171
|
+
// geometry.segment,
|
|
172
|
+
// geometry.parallel
|
|
173
|
+
// ],
|
|
174
|
+
// [
|
|
175
|
+
// exponent.squareRoot,
|
|
176
|
+
// exponent.nthRoot,
|
|
177
|
+
// misc.absValue,
|
|
178
|
+
// misc.parenthesis,
|
|
179
|
+
// geometry.perpindicular,
|
|
180
|
+
// geometry.angle
|
|
181
|
+
// ],
|
|
182
|
+
// [
|
|
183
|
+
// comparison.lessThan,
|
|
184
|
+
// comparison.greaterThan,
|
|
185
|
+
// geometry.degree,
|
|
186
|
+
// misc.approx,
|
|
187
|
+
// geometry.measureOfAngle,
|
|
188
|
+
// geometry.triangle
|
|
189
|
+
// ],
|
|
190
|
+
// [
|
|
191
|
+
// misc.nApprox,
|
|
192
|
+
// misc.notEqual,
|
|
193
|
+
// geometry.congruentTo,
|
|
194
|
+
// geometry.notCongruentTo,
|
|
195
|
+
// geometry.parallelogram,
|
|
196
|
+
// geometry.circledDot
|
|
197
|
+
// ],
|
|
198
|
+
// [
|
|
199
|
+
// misc.similar,
|
|
200
|
+
// misc.notSimilar,
|
|
201
|
+
// comparison.lessThanEqual,
|
|
202
|
+
// comparison.greaterThanEqual,
|
|
203
|
+
// vars.x,
|
|
204
|
+
// vars.y
|
|
205
|
+
// ]
|
|
206
|
+
// ]
|
|
207
|
+
// },
|
|
208
|
+
// {
|
|
160
209
|
// predicate: 'everything',
|
|
161
210
|
// set: [
|
|
162
211
|
// [
|
|
@@ -208,6 +257,71 @@ export const gradeSets = [
|
|
|
208
257
|
{
|
|
209
258
|
predicate: 'statistics',
|
|
210
259
|
set: statisticsSet
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
predicate: 'item-authoring',
|
|
263
|
+
set: [
|
|
264
|
+
[
|
|
265
|
+
basicOperators.divide,
|
|
266
|
+
fractions.blankOverBlank,
|
|
267
|
+
logic.longDivision,
|
|
268
|
+
constants.halfInfinity,
|
|
269
|
+
exponent.squared,
|
|
270
|
+
exponent.squareRoot,
|
|
271
|
+
geometry.overline,
|
|
272
|
+
geometry.overRightArrow,
|
|
273
|
+
geometry.overLeftRightArrow,
|
|
274
|
+
log.log
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
basicOperators.multiply,
|
|
278
|
+
operators.circleDot,
|
|
279
|
+
{ name: '', latex: '', write: '' },
|
|
280
|
+
subSup.subscript,
|
|
281
|
+
exponent.xToPowerOfN,
|
|
282
|
+
exponent.nthRoot,
|
|
283
|
+
geometry.perpindicular,
|
|
284
|
+
geometry.parallel,
|
|
285
|
+
geometry.overArc,
|
|
286
|
+
log.logSubscript
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
misc.plusMinus,
|
|
290
|
+
constants.pi,
|
|
291
|
+
vars.theta,
|
|
292
|
+
geometry.degree,
|
|
293
|
+
geometry.angle,
|
|
294
|
+
geometry.leftArrow,
|
|
295
|
+
geometry.rightArrow,
|
|
296
|
+
geometry.triangle,
|
|
297
|
+
geometry.square,
|
|
298
|
+
log.ln
|
|
299
|
+
],
|
|
300
|
+
[
|
|
301
|
+
misc.notEqual,
|
|
302
|
+
misc.absValue,
|
|
303
|
+
statistics.smallSigma,
|
|
304
|
+
statistics.mu,
|
|
305
|
+
logic.therefore,
|
|
306
|
+
statistics.sigma,
|
|
307
|
+
geometry.leftrightArrow,
|
|
308
|
+
trigonometry.sin,
|
|
309
|
+
trigonometry.cos,
|
|
310
|
+
trigonometry.tan
|
|
311
|
+
],
|
|
312
|
+
[
|
|
313
|
+
comparison.lessThanEqual,
|
|
314
|
+
comparison.greaterThanEqual,
|
|
315
|
+
{ name: '', latex: '', write: '' },
|
|
316
|
+
{ name: '', latex: '', write: '' },
|
|
317
|
+
constants.infinity,
|
|
318
|
+
{ name: '', latex: '', write: '' },
|
|
319
|
+
{ name: '', latex: '', write: '' },
|
|
320
|
+
trigonometry.csc,
|
|
321
|
+
trigonometry.sec,
|
|
322
|
+
trigonometry.cot
|
|
323
|
+
]
|
|
324
|
+
]
|
|
211
325
|
}
|
|
212
326
|
];
|
|
213
327
|
|
|
@@ -260,6 +374,6 @@ export const normalizeAdditionalKeys = additionalKeys => {
|
|
|
260
374
|
latex === key.otherNotation
|
|
261
375
|
);
|
|
262
376
|
|
|
263
|
-
return predefinedKey || additionalkey;
|
|
377
|
+
return !latex ? additionalkey : predefinedKey || additionalkey;
|
|
264
378
|
});
|
|
265
379
|
};
|
package/src/keys/log.js
CHANGED
package/src/keys/statistics.js
CHANGED
package/src/mq/input.jsx
CHANGED
|
@@ -134,6 +134,41 @@ export class Input extends React.Component {
|
|
|
134
134
|
this.write('\\embed{newLine}[]');
|
|
135
135
|
this.onInputEdit();
|
|
136
136
|
}
|
|
137
|
+
|
|
138
|
+
if (event.charCode === 47) {
|
|
139
|
+
// Whenever the math editor cursor is positioned after an integer
|
|
140
|
+
// (i.e. a sequence of 1 or more digits) followed immediately by a space followed immediately by another integer,
|
|
141
|
+
// then a side effect of pressing the forward slash key or clicking the B fraction button should be to remove
|
|
142
|
+
// the space between the first integer and the second integer (which is now the numerator of a new fraction).
|
|
143
|
+
// E.g. if the user were trying to enter the mixed number one and two-thirds, and typed [1], [space], [2], [forward slash],
|
|
144
|
+
// producing the latex 1\ \frac{2}{|} (where | is not actually part of the representation, but rather
|
|
145
|
+
// represents the position of the cursor), this should be automatically transformed to 1\frac{2}{|}
|
|
146
|
+
// (with | again representing the position of the cursor).
|
|
147
|
+
// Similarly, if the user had typed [1], [2], [space], [3], [4], [forward slash], then the resulting representation should
|
|
148
|
+
// be transformed from 12\ \frac{34}{|} to 12\frac{34}{|}.
|
|
149
|
+
const latex = this.mathField.latex();
|
|
150
|
+
|
|
151
|
+
if (latex.match(/([1-9])\\ /)) {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
|
|
155
|
+
this.clear();
|
|
156
|
+
|
|
157
|
+
const indexOfSpace = latex.lastIndexOf('\\ ');
|
|
158
|
+
// split the latex by the last space added
|
|
159
|
+
const firstPart = latex.slice(0, indexOfSpace);
|
|
160
|
+
const secondPart = latex.slice(indexOfSpace + 2);
|
|
161
|
+
|
|
162
|
+
// reconstruct the latex without the extra space
|
|
163
|
+
const newLatex = firstPart + '\\frac{' + secondPart + '}{}';
|
|
164
|
+
|
|
165
|
+
this.mathField.latex(newLatex);
|
|
166
|
+
// trigger pressing keydown to move focus on the denominator
|
|
167
|
+
this.mathField.el().dispatchEvent(new KeyboardEvent('keydown', { keyCode: 37 }));
|
|
168
|
+
|
|
169
|
+
this.onInputEdit();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
137
172
|
};
|
|
138
173
|
|
|
139
174
|
shouldComponentUpdate(nextProps) {
|