@pie-element/math-inline 5.9.9 → 5.9.12
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.md +24 -0
- package/configure/CHANGELOG.md +24 -0
- package/configure/lib/general-config-block.js +50 -6
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/response.js +19 -5
- package/configure/lib/response.js.map +1 -1
- package/configure/lib/utils.js +18 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +70 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +5 -0
- package/docs/config-schema.json.md +4 -0
- package/package.json +6 -6
- package/module/configure.js +0 -1473
- package/module/controller.js +0 -1372
- package/module/demo.js +0 -48
- package/module/element.js +0 -2045
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -86
- package/module/print.html +0 -18
- package/module/print.js +0 -1909
package/module/print.js
DELETED
|
@@ -1,1909 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_debug, _dll_prop_types, _dll_classnames, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__icons, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.15/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.3/module/index.js";
|
|
3
|
-
import {_dll_pie_lib__math_input, _dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.2.2/module/index.js";
|
|
4
|
-
const ResponseTypes = {
|
|
5
|
-
advanced: 'Advanced Multi',
|
|
6
|
-
simple: 'Simple'
|
|
7
|
-
};
|
|
8
|
-
const {HorizontalKeypad: HorizontalKeypad$1} = _dll_pie_lib__math_input;
|
|
9
|
-
const {mq: mq$3} = _dll_pie_lib__math_input;
|
|
10
|
-
const {updateSpans: updateSpans$1} = _dll_pie_lib__math_input;
|
|
11
|
-
const React$6 = _dll_react;
|
|
12
|
-
const debug$2 = _dll_debug;
|
|
13
|
-
const PropTypes$5 = _dll_prop_types;
|
|
14
|
-
const cx$3 = _dll_classnames;
|
|
15
|
-
const {Button: Button} = _dll_material_ui__core;
|
|
16
|
-
const {MenuItem: MenuItem} = _dll_material_ui__core;
|
|
17
|
-
const {Select: Select} = _dll_material_ui__core;
|
|
18
|
-
const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
|
|
19
|
-
const {color: color$2} = _dll_pie_lib__render_ui;
|
|
20
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__render_ui;
|
|
21
|
-
const _jsxFileName$5 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/editor-and-pad.jsx";
|
|
22
|
-
const log$2 = debug$2('@pie-lib:math-toolbar:editor-and-pad');
|
|
23
|
-
const decimalRegex = /\.|,/g;
|
|
24
|
-
const toNodeData = data => {
|
|
25
|
-
if (!data) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const {type, value} = data;
|
|
29
|
-
if (type === 'command' || type === 'cursor') {
|
|
30
|
-
return data;
|
|
31
|
-
} else if (type === 'answer') {
|
|
32
|
-
return {
|
|
33
|
-
type: 'answer',
|
|
34
|
-
...data
|
|
35
|
-
};
|
|
36
|
-
} else if (value === 'clear') {
|
|
37
|
-
return {
|
|
38
|
-
type: 'clear'
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
return {
|
|
42
|
-
type: 'write',
|
|
43
|
-
value
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
class EditorAndPad extends React$6.Component {
|
|
48
|
-
static __initStatic() {
|
|
49
|
-
this.propTypes = {
|
|
50
|
-
classNames: PropTypes$5.object,
|
|
51
|
-
keypadMode: PropTypes$5.oneOfType([PropTypes$5.string, PropTypes$5.number]),
|
|
52
|
-
autoFocus: PropTypes$5.bool,
|
|
53
|
-
allowAnswerBlock: PropTypes$5.bool,
|
|
54
|
-
showKeypad: PropTypes$5.bool,
|
|
55
|
-
controlledKeypad: PropTypes$5.bool,
|
|
56
|
-
controlledKeypadMode: PropTypes$5.bool,
|
|
57
|
-
noDecimal: PropTypes$5.bool,
|
|
58
|
-
additionalKeys: PropTypes$5.array,
|
|
59
|
-
latex: PropTypes$5.string.isRequired,
|
|
60
|
-
onAnswerBlockAdd: PropTypes$5.func,
|
|
61
|
-
onFocus: PropTypes$5.func,
|
|
62
|
-
onBlur: PropTypes$5.func,
|
|
63
|
-
onChange: PropTypes$5.func.isRequired,
|
|
64
|
-
classes: PropTypes$5.object
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
constructor(props) {
|
|
68
|
-
super(props);
|
|
69
|
-
EditorAndPad.prototype.__init.call(this);
|
|
70
|
-
EditorAndPad.prototype.__init2.call(this);
|
|
71
|
-
EditorAndPad.prototype.__init3.call(this);
|
|
72
|
-
EditorAndPad.prototype.__init4.call(this);
|
|
73
|
-
EditorAndPad.prototype.__init5.call(this);
|
|
74
|
-
EditorAndPad.prototype.__init6.call(this);
|
|
75
|
-
this.state = {
|
|
76
|
-
equationEditor: 'item-authoring',
|
|
77
|
-
addDisabled: false
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
componentDidMount() {
|
|
81
|
-
if (this.input && this.props.autoFocus) {
|
|
82
|
-
this.input.focus();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
__init() {
|
|
86
|
-
this.onClick = data => {
|
|
87
|
-
const {noDecimal} = this.props;
|
|
88
|
-
const c = toNodeData(data);
|
|
89
|
-
log$2('mathChange: ', c);
|
|
90
|
-
if (noDecimal && (c.value === '.' || c.value === ',')) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (c.type === 'clear') {
|
|
94
|
-
log$2('call clear...');
|
|
95
|
-
this.input.clear();
|
|
96
|
-
} else if (c.type === 'command') {
|
|
97
|
-
this.input.command(c.value);
|
|
98
|
-
} else if (c.type === 'cursor') {
|
|
99
|
-
this.input.keystroke(c.value);
|
|
100
|
-
} else if (c.type === 'answer') {
|
|
101
|
-
this.input.write('%response%');
|
|
102
|
-
} else {
|
|
103
|
-
this.input.write(c.value);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
__init2() {
|
|
108
|
-
this.updateDisable = isEdit => {
|
|
109
|
-
const {maxResponseAreas} = this.props;
|
|
110
|
-
if (maxResponseAreas) {
|
|
111
|
-
const shouldDisable = this.checkResponseAreasNumber(maxResponseAreas, isEdit);
|
|
112
|
-
this.setState({
|
|
113
|
-
addDisabled: shouldDisable
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
__init3() {
|
|
119
|
-
this.onAnswerBlockClick = () => {
|
|
120
|
-
this.props.onAnswerBlockAdd();
|
|
121
|
-
this.onClick({
|
|
122
|
-
type: 'answer'
|
|
123
|
-
});
|
|
124
|
-
this.updateDisable(true);
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
__init4() {
|
|
128
|
-
this.onEditorChange = latex => {
|
|
129
|
-
const {onChange, noDecimal} = this.props;
|
|
130
|
-
updateSpans$1();
|
|
131
|
-
this.updateDisable(true);
|
|
132
|
-
if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && this.input) {
|
|
133
|
-
this.input.clear();
|
|
134
|
-
this.input.write(latex.replace(decimalRegex, ''));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
onChange(latex);
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
141
|
-
const inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
|
|
142
|
-
log$2('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
|
|
143
|
-
if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
if (!inputIsDifferent && this.props.controlledKeypad) {
|
|
153
|
-
return this.props.showKeypad !== nextProps.showKeypad;
|
|
154
|
-
}
|
|
155
|
-
return inputIsDifferent;
|
|
156
|
-
}
|
|
157
|
-
__init5() {
|
|
158
|
-
this.onEditorTypeChange = evt => {
|
|
159
|
-
this.setState({
|
|
160
|
-
equationEditor: evt.target.value
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
__init6() {
|
|
165
|
-
this.checkResponseAreasNumber = (maxResponseAreas, isEdit) => {
|
|
166
|
-
const {latex} = this.input && this.input.props || ({});
|
|
167
|
-
if (latex) {
|
|
168
|
-
const count = (latex.match(/answerBlock/g) || []).length;
|
|
169
|
-
return isEdit ? count === maxResponseAreas - 1 : count === maxResponseAreas;
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
render() {
|
|
175
|
-
const {classNames, keypadMode, allowAnswerBlock, additionalKeys, controlledKeypad, controlledKeypadMode, showKeypad, noDecimal, latex, onFocus, onBlur, classes, error} = this.props;
|
|
176
|
-
const shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
|
|
177
|
-
const {addDisabled} = this.state;
|
|
178
|
-
log$2('[render]', latex);
|
|
179
|
-
return React$6.createElement('div', {
|
|
180
|
-
className: cx$3(classes.mathToolbar, classNames.mathToolbar),
|
|
181
|
-
__self: this,
|
|
182
|
-
__source: {
|
|
183
|
-
fileName: _jsxFileName$5,
|
|
184
|
-
lineNumber: 188
|
|
185
|
-
}
|
|
186
|
-
}, React$6.createElement('div', {
|
|
187
|
-
className: classes.inputAndTypeContainer,
|
|
188
|
-
__self: this,
|
|
189
|
-
__source: {
|
|
190
|
-
fileName: _jsxFileName$5,
|
|
191
|
-
lineNumber: 189
|
|
192
|
-
}
|
|
193
|
-
}, controlledKeypadMode && React$6.createElement(InputContainer, {
|
|
194
|
-
label: "Equation Editor",
|
|
195
|
-
className: classes.selectContainer,
|
|
196
|
-
__self: this,
|
|
197
|
-
__source: {
|
|
198
|
-
fileName: _jsxFileName$5,
|
|
199
|
-
lineNumber: 191
|
|
200
|
-
}
|
|
201
|
-
}, React$6.createElement(Select, {
|
|
202
|
-
className: classes.select,
|
|
203
|
-
onChange: this.onEditorTypeChange,
|
|
204
|
-
value: this.state.equationEditor,
|
|
205
|
-
__self: this,
|
|
206
|
-
__source: {
|
|
207
|
-
fileName: _jsxFileName$5,
|
|
208
|
-
lineNumber: 192
|
|
209
|
-
}
|
|
210
|
-
}, React$6.createElement(MenuItem, {
|
|
211
|
-
value: "non-negative-integers",
|
|
212
|
-
__self: this,
|
|
213
|
-
__source: {
|
|
214
|
-
fileName: _jsxFileName$5,
|
|
215
|
-
lineNumber: 197
|
|
216
|
-
}
|
|
217
|
-
}, "Numeric - Non-Negative Integers"), React$6.createElement(MenuItem, {
|
|
218
|
-
value: "integers",
|
|
219
|
-
__self: this,
|
|
220
|
-
__source: {
|
|
221
|
-
fileName: _jsxFileName$5,
|
|
222
|
-
lineNumber: 198
|
|
223
|
-
}
|
|
224
|
-
}, "Numeric - Integers"), React$6.createElement(MenuItem, {
|
|
225
|
-
value: "decimals",
|
|
226
|
-
__self: this,
|
|
227
|
-
__source: {
|
|
228
|
-
fileName: _jsxFileName$5,
|
|
229
|
-
lineNumber: 199
|
|
230
|
-
}
|
|
231
|
-
}, "Numeric - Decimals"), React$6.createElement(MenuItem, {
|
|
232
|
-
value: "fractions",
|
|
233
|
-
__self: this,
|
|
234
|
-
__source: {
|
|
235
|
-
fileName: _jsxFileName$5,
|
|
236
|
-
lineNumber: 200
|
|
237
|
-
}
|
|
238
|
-
}, "Numeric - Fractions"), React$6.createElement(MenuItem, {
|
|
239
|
-
value: 1,
|
|
240
|
-
__self: this,
|
|
241
|
-
__source: {
|
|
242
|
-
fileName: _jsxFileName$5,
|
|
243
|
-
lineNumber: 201
|
|
244
|
-
}
|
|
245
|
-
}, "Grade 1 - 2"), React$6.createElement(MenuItem, {
|
|
246
|
-
value: 3,
|
|
247
|
-
__self: this,
|
|
248
|
-
__source: {
|
|
249
|
-
fileName: _jsxFileName$5,
|
|
250
|
-
lineNumber: 202
|
|
251
|
-
}
|
|
252
|
-
}, "Grade 3 - 5"), React$6.createElement(MenuItem, {
|
|
253
|
-
value: 6,
|
|
254
|
-
__self: this,
|
|
255
|
-
__source: {
|
|
256
|
-
fileName: _jsxFileName$5,
|
|
257
|
-
lineNumber: 203
|
|
258
|
-
}
|
|
259
|
-
}, "Grade 6 - 7"), React$6.createElement(MenuItem, {
|
|
260
|
-
value: 8,
|
|
261
|
-
__self: this,
|
|
262
|
-
__source: {
|
|
263
|
-
fileName: _jsxFileName$5,
|
|
264
|
-
lineNumber: 204
|
|
265
|
-
}
|
|
266
|
-
}, "Grade 8 - HS"), React$6.createElement(MenuItem, {
|
|
267
|
-
value: 'geometry',
|
|
268
|
-
__self: this,
|
|
269
|
-
__source: {
|
|
270
|
-
fileName: _jsxFileName$5,
|
|
271
|
-
lineNumber: 205
|
|
272
|
-
}
|
|
273
|
-
}, "Geometry"), React$6.createElement(MenuItem, {
|
|
274
|
-
value: 'advanced-algebra',
|
|
275
|
-
__self: this,
|
|
276
|
-
__source: {
|
|
277
|
-
fileName: _jsxFileName$5,
|
|
278
|
-
lineNumber: 206
|
|
279
|
-
}
|
|
280
|
-
}, "Advanced Algebra"), React$6.createElement(MenuItem, {
|
|
281
|
-
value: 'statistics',
|
|
282
|
-
__self: this,
|
|
283
|
-
__source: {
|
|
284
|
-
fileName: _jsxFileName$5,
|
|
285
|
-
lineNumber: 207
|
|
286
|
-
}
|
|
287
|
-
}, "Statistics"), React$6.createElement(MenuItem, {
|
|
288
|
-
value: 'item-authoring',
|
|
289
|
-
__self: this,
|
|
290
|
-
__source: {
|
|
291
|
-
fileName: _jsxFileName$5,
|
|
292
|
-
lineNumber: 208
|
|
293
|
-
}
|
|
294
|
-
}, "Item Authoring"))), React$6.createElement('div', {
|
|
295
|
-
className: cx$3(classes.inputContainer, error ? classes.error : ''),
|
|
296
|
-
__self: this,
|
|
297
|
-
__source: {
|
|
298
|
-
fileName: _jsxFileName$5,
|
|
299
|
-
lineNumber: 212
|
|
300
|
-
}
|
|
301
|
-
}, React$6.createElement(mq$3.Input, {
|
|
302
|
-
onFocus: () => {
|
|
303
|
-
onFocus && onFocus();
|
|
304
|
-
this.updateDisable(false);
|
|
305
|
-
},
|
|
306
|
-
onBlur: event => {
|
|
307
|
-
this.updateDisable(false);
|
|
308
|
-
onBlur && onBlur(event);
|
|
309
|
-
},
|
|
310
|
-
className: cx$3(classes.mathEditor, classNames.editor, !controlledKeypadMode ? classes.longMathEditor : ''),
|
|
311
|
-
innerRef: r => this.input = r,
|
|
312
|
-
latex: latex,
|
|
313
|
-
onChange: this.onEditorChange,
|
|
314
|
-
__self: this,
|
|
315
|
-
__source: {
|
|
316
|
-
fileName: _jsxFileName$5,
|
|
317
|
-
lineNumber: 213
|
|
318
|
-
}
|
|
319
|
-
}))), allowAnswerBlock && React$6.createElement(Button, {
|
|
320
|
-
className: classes.addAnswerBlockButton,
|
|
321
|
-
type: "primary",
|
|
322
|
-
style: {
|
|
323
|
-
bottom: shouldShowKeypad ? '320px' : '20px'
|
|
324
|
-
},
|
|
325
|
-
onClick: this.onAnswerBlockClick,
|
|
326
|
-
disabled: addDisabled,
|
|
327
|
-
__self: this,
|
|
328
|
-
__source: {
|
|
329
|
-
fileName: _jsxFileName$5,
|
|
330
|
-
lineNumber: 234
|
|
331
|
-
}
|
|
332
|
-
}, "+ Response Area"), React$6.createElement('hr', {
|
|
333
|
-
className: classes.hr,
|
|
334
|
-
__self: this,
|
|
335
|
-
__source: {
|
|
336
|
-
fileName: _jsxFileName$5,
|
|
337
|
-
lineNumber: 244
|
|
338
|
-
}
|
|
339
|
-
}), shouldShowKeypad && React$6.createElement(HorizontalKeypad$1, {
|
|
340
|
-
additionalKeys: additionalKeys,
|
|
341
|
-
mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
|
|
342
|
-
onClick: this.onClick,
|
|
343
|
-
noDecimal: noDecimal,
|
|
344
|
-
__self: this,
|
|
345
|
-
__source: {
|
|
346
|
-
fileName: _jsxFileName$5,
|
|
347
|
-
lineNumber: 246
|
|
348
|
-
}
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
EditorAndPad.__initStatic();
|
|
353
|
-
const styles$3 = theme => ({
|
|
354
|
-
inputAndTypeContainer: {
|
|
355
|
-
display: 'flex',
|
|
356
|
-
alignItems: 'center',
|
|
357
|
-
'& *': {
|
|
358
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
359
|
-
},
|
|
360
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
361
|
-
minWidth: '1.23em',
|
|
362
|
-
'& *': {
|
|
363
|
-
lineHeight: '1 !important'
|
|
364
|
-
},
|
|
365
|
-
'&:before': {
|
|
366
|
-
top: '-0.4em',
|
|
367
|
-
left: '-1px'
|
|
368
|
-
},
|
|
369
|
-
'&:after': {
|
|
370
|
-
top: '-2.36em',
|
|
371
|
-
right: '-1px'
|
|
372
|
-
},
|
|
373
|
-
'&.mq-empty:after': {
|
|
374
|
-
top: '-0.45em'
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
378
|
-
'&:before': {
|
|
379
|
-
top: '-0.4em',
|
|
380
|
-
right: '-1px'
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
selectContainer: {
|
|
385
|
-
flex: 'initial',
|
|
386
|
-
width: '25%',
|
|
387
|
-
minWidth: '100px',
|
|
388
|
-
marginLeft: '15px',
|
|
389
|
-
marginTop: '5px',
|
|
390
|
-
marginBottom: '5px',
|
|
391
|
-
marginRight: '5px'
|
|
392
|
-
},
|
|
393
|
-
mathEditor: {
|
|
394
|
-
maxWidth: '400px',
|
|
395
|
-
color: color$2.text(),
|
|
396
|
-
backgroundColor: color$2.background(),
|
|
397
|
-
padding: theme.spacing.unit
|
|
398
|
-
},
|
|
399
|
-
longMathEditor: {
|
|
400
|
-
maxWidth: '500px'
|
|
401
|
-
},
|
|
402
|
-
addAnswerBlockButton: {
|
|
403
|
-
position: 'absolute',
|
|
404
|
-
right: '12px',
|
|
405
|
-
border: '1px solid lightgrey'
|
|
406
|
-
},
|
|
407
|
-
hr: {
|
|
408
|
-
padding: 0,
|
|
409
|
-
margin: 0,
|
|
410
|
-
height: '1px',
|
|
411
|
-
border: 'none',
|
|
412
|
-
borderBottom: `solid 1px ${theme.palette.primary.main}`
|
|
413
|
-
},
|
|
414
|
-
mathToolbar: {
|
|
415
|
-
zIndex: 9,
|
|
416
|
-
position: 'relative',
|
|
417
|
-
textAlign: 'center',
|
|
418
|
-
width: 'auto',
|
|
419
|
-
'& > .mq-math-mode': {
|
|
420
|
-
border: 'solid 1px lightgrey'
|
|
421
|
-
},
|
|
422
|
-
'& > .mq-focused': {
|
|
423
|
-
outline: 'none',
|
|
424
|
-
boxShadow: 'none',
|
|
425
|
-
border: `dotted 1px ${theme.palette.primary.main}`,
|
|
426
|
-
borderRadius: '0px'
|
|
427
|
-
},
|
|
428
|
-
'& .mq-overarrow-inner': {
|
|
429
|
-
border: 'none !important',
|
|
430
|
-
paddingTop: '0 !important'
|
|
431
|
-
},
|
|
432
|
-
'& .mq-overarrow-inner-right': {
|
|
433
|
-
display: 'none !important'
|
|
434
|
-
},
|
|
435
|
-
'& .mq-overarrow-inner-left': {
|
|
436
|
-
display: 'none !important'
|
|
437
|
-
},
|
|
438
|
-
'& .mq-longdiv-inner': {
|
|
439
|
-
borderTop: '1px solid !important',
|
|
440
|
-
paddingTop: '1.5px !important'
|
|
441
|
-
},
|
|
442
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
443
|
-
minWidth: '1.23em'
|
|
444
|
-
},
|
|
445
|
-
'& .mq-parallelogram': {
|
|
446
|
-
lineHeight: 0.85
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
inputContainer: {
|
|
450
|
-
minWidth: '500px',
|
|
451
|
-
maxWidth: '900px',
|
|
452
|
-
minHeight: '40px',
|
|
453
|
-
width: '100%',
|
|
454
|
-
display: 'flex',
|
|
455
|
-
marginTop: theme.spacing.unit,
|
|
456
|
-
marginBottom: theme.spacing.unit
|
|
457
|
-
},
|
|
458
|
-
error: {
|
|
459
|
-
border: '2px solid red'
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
var EditorAndPad$1 = withStyles$5(styles$3)(EditorAndPad);
|
|
463
|
-
const React$5 = _dll_react;
|
|
464
|
-
const {IconButton: IconButton} = _dll_material_ui__core;
|
|
465
|
-
const {Check: Check} = _dll_material_ui__icons;
|
|
466
|
-
const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
|
|
467
|
-
const PropTypes$4 = _dll_prop_types;
|
|
468
|
-
const _jsxFileName$4 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/done-button.jsx";
|
|
469
|
-
const RawDoneButton = ({classes, onClick}) => React$5.createElement(IconButton, {
|
|
470
|
-
'aria-label': "Done",
|
|
471
|
-
className: classes.iconRoot,
|
|
472
|
-
onClick: onClick,
|
|
473
|
-
classes: {
|
|
474
|
-
label: classes.label,
|
|
475
|
-
root: classes.iconRoot
|
|
476
|
-
},
|
|
477
|
-
__self: undefined,
|
|
478
|
-
__source: {
|
|
479
|
-
fileName: _jsxFileName$4,
|
|
480
|
-
lineNumber: 9
|
|
481
|
-
}
|
|
482
|
-
}, React$5.createElement(Check, {
|
|
483
|
-
__self: undefined,
|
|
484
|
-
__source: {
|
|
485
|
-
fileName: _jsxFileName$4,
|
|
486
|
-
lineNumber: 18
|
|
487
|
-
}
|
|
488
|
-
}));
|
|
489
|
-
RawDoneButton.propTypes = {
|
|
490
|
-
classes: PropTypes$4.object.isRequired,
|
|
491
|
-
onClick: PropTypes$4.func
|
|
492
|
-
};
|
|
493
|
-
const styles$2 = {
|
|
494
|
-
iconRoot: {
|
|
495
|
-
verticalAlign: 'top',
|
|
496
|
-
width: '28px',
|
|
497
|
-
height: '28px',
|
|
498
|
-
color: '#00bb00'
|
|
499
|
-
},
|
|
500
|
-
label: {
|
|
501
|
-
position: 'absolute',
|
|
502
|
-
top: '2px'
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
const DoneButton = withStyles$4(styles$2)(RawDoneButton);
|
|
506
|
-
const React$4 = _dll_react;
|
|
507
|
-
const classNames = _dll_classnames;
|
|
508
|
-
const debug$1 = _dll_debug;
|
|
509
|
-
const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
|
|
510
|
-
const PropTypes$3 = _dll_prop_types;
|
|
511
|
-
const {mq: mq$2} = _dll_pie_lib__math_input;
|
|
512
|
-
const _jsxFileName$3 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/math-preview.jsx";
|
|
513
|
-
const log$1 = debug$1('@pie-lib:math-toolbar:math-preview');
|
|
514
|
-
class RawMathPreview extends React$4.Component {
|
|
515
|
-
static __initStatic() {
|
|
516
|
-
this.propTypes = {
|
|
517
|
-
latex: PropTypes$3.string,
|
|
518
|
-
node: PropTypes$3.object,
|
|
519
|
-
classes: PropTypes$3.object,
|
|
520
|
-
isSelected: PropTypes$3.bool,
|
|
521
|
-
onFocus: PropTypes$3.func,
|
|
522
|
-
onBlur: PropTypes$3.func
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
render() {
|
|
526
|
-
log$1('[render] data: ', this.props.node.data);
|
|
527
|
-
const latex = this.props.node.data.get('latex');
|
|
528
|
-
const {classes, isSelected, onFocus, onBlur} = this.props;
|
|
529
|
-
return React$4.createElement('div', {
|
|
530
|
-
className: classNames(classes.root, isSelected && classes.selected),
|
|
531
|
-
__self: this,
|
|
532
|
-
__source: {
|
|
533
|
-
fileName: _jsxFileName$3,
|
|
534
|
-
lineNumber: 25
|
|
535
|
-
}
|
|
536
|
-
}, ' ', React$4.createElement('span', {
|
|
537
|
-
className: classes.insideOverlay,
|
|
538
|
-
__self: this,
|
|
539
|
-
__source: {
|
|
540
|
-
fileName: _jsxFileName$3,
|
|
541
|
-
lineNumber: 27
|
|
542
|
-
}
|
|
543
|
-
}), React$4.createElement(mq$2.Static, {
|
|
544
|
-
latex: latex,
|
|
545
|
-
onFocus: onFocus,
|
|
546
|
-
onBlur: onBlur,
|
|
547
|
-
__self: this,
|
|
548
|
-
__source: {
|
|
549
|
-
fileName: _jsxFileName$3,
|
|
550
|
-
lineNumber: 28
|
|
551
|
-
}
|
|
552
|
-
}));
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
RawMathPreview.__initStatic();
|
|
556
|
-
const mp = theme => ({
|
|
557
|
-
root: {
|
|
558
|
-
display: 'inline-flex',
|
|
559
|
-
alignItems: 'center',
|
|
560
|
-
position: 'relative',
|
|
561
|
-
'& > .mq-math-mode': {
|
|
562
|
-
border: 'solid 1px lightgrey'
|
|
563
|
-
},
|
|
564
|
-
'& > .mq-focused': {
|
|
565
|
-
outline: 'none',
|
|
566
|
-
boxShadow: 'none',
|
|
567
|
-
border: 'solid 1px black',
|
|
568
|
-
borderRadius: '0px'
|
|
569
|
-
},
|
|
570
|
-
'& *': {
|
|
571
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
572
|
-
},
|
|
573
|
-
'& .mq-overarrow-inner': {
|
|
574
|
-
paddingTop: '0 !important',
|
|
575
|
-
border: 'none !important'
|
|
576
|
-
},
|
|
577
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
578
|
-
minWidth: '1.23em',
|
|
579
|
-
'& *': {
|
|
580
|
-
lineHeight: '1 !important'
|
|
581
|
-
},
|
|
582
|
-
'&:before': {
|
|
583
|
-
top: '-0.4em',
|
|
584
|
-
left: '-1px'
|
|
585
|
-
},
|
|
586
|
-
'&:after': {
|
|
587
|
-
top: '-2.36em',
|
|
588
|
-
right: '-1px'
|
|
589
|
-
},
|
|
590
|
-
'&.mq-empty:after': {
|
|
591
|
-
top: '-0.45em'
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
595
|
-
'&:before': {
|
|
596
|
-
top: '-0.4em',
|
|
597
|
-
right: '-1px'
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
'& .mq-overarrow-inner-right': {
|
|
601
|
-
display: 'none !important'
|
|
602
|
-
},
|
|
603
|
-
'& .mq-overarrow-inner-left': {
|
|
604
|
-
display: 'none !important'
|
|
605
|
-
},
|
|
606
|
-
'& .mq-longdiv-inner': {
|
|
607
|
-
borderTop: '1px solid !important',
|
|
608
|
-
paddingTop: '1.5px !important'
|
|
609
|
-
},
|
|
610
|
-
'& .mq-parallelogram': {
|
|
611
|
-
lineHeight: 0.85
|
|
612
|
-
}
|
|
613
|
-
},
|
|
614
|
-
selected: {
|
|
615
|
-
border: `solid 1px ${theme.palette.primary.main}`,
|
|
616
|
-
'& > .mq-math-mode': {
|
|
617
|
-
border: 'solid 0px lightgrey'
|
|
618
|
-
}
|
|
619
|
-
},
|
|
620
|
-
insideOverlay: {
|
|
621
|
-
position: 'absolute',
|
|
622
|
-
bottom: 0,
|
|
623
|
-
left: 0,
|
|
624
|
-
right: 0,
|
|
625
|
-
top: 0
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
withStyles$3(mp)(RawMathPreview);
|
|
629
|
-
const React$3 = _dll_react;
|
|
630
|
-
const PropTypes$2 = _dll_prop_types;
|
|
631
|
-
const cx$2 = _dll_classnames;
|
|
632
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
633
|
-
const _jsxFileName$2 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/index.jsx";
|
|
634
|
-
class MathToolbar extends React$3.Component {
|
|
635
|
-
static __initStatic() {
|
|
636
|
-
this.propTypes = {
|
|
637
|
-
autoFocus: PropTypes$2.bool,
|
|
638
|
-
allowAnswerBlock: PropTypes$2.bool,
|
|
639
|
-
controlledKeypad: PropTypes$2.bool,
|
|
640
|
-
controlledKeypadMode: PropTypes$2.bool,
|
|
641
|
-
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
642
|
-
classNames: PropTypes$2.object,
|
|
643
|
-
showKeypad: PropTypes$2.bool,
|
|
644
|
-
noDecimal: PropTypes$2.bool,
|
|
645
|
-
additionalKeys: PropTypes$2.array,
|
|
646
|
-
latex: PropTypes$2.string.isRequired,
|
|
647
|
-
onAnswerBlockAdd: PropTypes$2.func,
|
|
648
|
-
onChange: PropTypes$2.func,
|
|
649
|
-
onDone: PropTypes$2.func.isRequired,
|
|
650
|
-
onFocus: PropTypes$2.func,
|
|
651
|
-
onBlur: PropTypes$2.func,
|
|
652
|
-
hideDoneButton: PropTypes$2.bool
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
static __initStatic2() {
|
|
656
|
-
this.defaultProps = {
|
|
657
|
-
classNames: {},
|
|
658
|
-
keypadMode: 'item-authoring',
|
|
659
|
-
autoFocus: false,
|
|
660
|
-
allowAnswerBlock: false,
|
|
661
|
-
controlledKeypad: false,
|
|
662
|
-
controlledKeypadMode: false,
|
|
663
|
-
noDecimal: false,
|
|
664
|
-
showKeypad: true,
|
|
665
|
-
additionalKeys: [],
|
|
666
|
-
onChange: () => {},
|
|
667
|
-
onAnswerBlockAdd: () => {},
|
|
668
|
-
onFocus: () => {},
|
|
669
|
-
hideDoneButton: false
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
constructor(props) {
|
|
673
|
-
super(props);
|
|
674
|
-
MathToolbar.prototype.__init.call(this);
|
|
675
|
-
MathToolbar.prototype.__init2.call(this);
|
|
676
|
-
this.state = {
|
|
677
|
-
latex: props.latex
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
__init() {
|
|
681
|
-
this.done = () => {
|
|
682
|
-
this.props.onDone(this.state.latex);
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
686
|
-
this.setState({
|
|
687
|
-
latex: nextProps.latex
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
__init2() {
|
|
691
|
-
this.onChange = latex => {
|
|
692
|
-
this.setState({
|
|
693
|
-
latex
|
|
694
|
-
});
|
|
695
|
-
this.props.onChange(latex);
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
render() {
|
|
699
|
-
const {latex} = this.state;
|
|
700
|
-
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, keypadMode, noDecimal, additionalKeys, showKeypad, onFocus, onBlur, hideDoneButton, error, maxResponseAreas} = this.props;
|
|
701
|
-
return React$3.createElement(PureToolbar, {
|
|
702
|
-
autoFocus: autoFocus,
|
|
703
|
-
classNames: classNames,
|
|
704
|
-
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
705
|
-
allowAnswerBlock: allowAnswerBlock,
|
|
706
|
-
latex: latex,
|
|
707
|
-
additionalKeys: additionalKeys,
|
|
708
|
-
noDecimal: noDecimal,
|
|
709
|
-
keypadMode: keypadMode,
|
|
710
|
-
onChange: this.onChange,
|
|
711
|
-
onDone: this.done,
|
|
712
|
-
onFocus: onFocus,
|
|
713
|
-
onBlur: onBlur,
|
|
714
|
-
showKeypad: showKeypad,
|
|
715
|
-
controlledKeypad: controlledKeypad,
|
|
716
|
-
controlledKeypadMode: controlledKeypadMode,
|
|
717
|
-
hideDoneButton: hideDoneButton,
|
|
718
|
-
error: error,
|
|
719
|
-
maxResponseAreas: maxResponseAreas,
|
|
720
|
-
__self: this,
|
|
721
|
-
__source: {
|
|
722
|
-
fileName: _jsxFileName$2,
|
|
723
|
-
lineNumber: 88
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
MathToolbar.__initStatic();
|
|
729
|
-
MathToolbar.__initStatic2();
|
|
730
|
-
class RawPureToolbar extends React$3.Component {
|
|
731
|
-
static __initStatic3() {
|
|
732
|
-
this.propTypes = {
|
|
733
|
-
classNames: PropTypes$2.object,
|
|
734
|
-
latex: PropTypes$2.string.isRequired,
|
|
735
|
-
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
736
|
-
onChange: PropTypes$2.func.isRequired,
|
|
737
|
-
onDone: PropTypes$2.func.isRequired,
|
|
738
|
-
onBlur: PropTypes$2.func,
|
|
739
|
-
onAnswerBlockAdd: PropTypes$2.func,
|
|
740
|
-
additionalKeys: PropTypes$2.array,
|
|
741
|
-
onFocus: PropTypes$2.func,
|
|
742
|
-
classes: PropTypes$2.object.isRequired,
|
|
743
|
-
autoFocus: PropTypes$2.bool,
|
|
744
|
-
noDecimal: PropTypes$2.bool,
|
|
745
|
-
allowAnswerBlock: PropTypes$2.bool,
|
|
746
|
-
controlledKeypad: PropTypes$2.bool,
|
|
747
|
-
controlledKeypadMode: PropTypes$2.bool,
|
|
748
|
-
showKeypad: PropTypes$2.bool,
|
|
749
|
-
hideDoneButton: PropTypes$2.bool
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
render() {
|
|
753
|
-
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, additionalKeys, showKeypad, keypadMode, noDecimal, latex, onChange, onDone, onFocus, onBlur, hideDoneButton, classes, error, maxResponseAreas} = this.props;
|
|
754
|
-
return React$3.createElement('div', {
|
|
755
|
-
className: cx$2(classes.pureToolbar, (classNames || ({})).toolbar),
|
|
756
|
-
__self: this,
|
|
757
|
-
__source: {
|
|
758
|
-
fileName: _jsxFileName$2,
|
|
759
|
-
lineNumber: 157
|
|
760
|
-
}
|
|
761
|
-
}, React$3.createElement('div', {
|
|
762
|
-
__self: this,
|
|
763
|
-
__source: {
|
|
764
|
-
fileName: _jsxFileName$2,
|
|
765
|
-
lineNumber: 158
|
|
766
|
-
}
|
|
767
|
-
}), React$3.createElement(EditorAndPad$1, {
|
|
768
|
-
autoFocus: autoFocus,
|
|
769
|
-
keypadMode: keypadMode,
|
|
770
|
-
classNames: classNames || ({}),
|
|
771
|
-
controlledKeypad: controlledKeypad,
|
|
772
|
-
controlledKeypadMode: controlledKeypadMode,
|
|
773
|
-
noDecimal: noDecimal,
|
|
774
|
-
showKeypad: showKeypad,
|
|
775
|
-
additionalKeys: additionalKeys,
|
|
776
|
-
allowAnswerBlock: allowAnswerBlock,
|
|
777
|
-
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
778
|
-
latex: latex,
|
|
779
|
-
onChange: onChange,
|
|
780
|
-
onFocus: onFocus,
|
|
781
|
-
onBlur: onBlur,
|
|
782
|
-
error: error,
|
|
783
|
-
maxResponseAreas: maxResponseAreas,
|
|
784
|
-
__self: this,
|
|
785
|
-
__source: {
|
|
786
|
-
fileName: _jsxFileName$2,
|
|
787
|
-
lineNumber: 159
|
|
788
|
-
}
|
|
789
|
-
}), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && React$3.createElement(DoneButton, {
|
|
790
|
-
onClick: onDone,
|
|
791
|
-
__self: this,
|
|
792
|
-
__source: {
|
|
793
|
-
fileName: _jsxFileName$2,
|
|
794
|
-
lineNumber: 178
|
|
795
|
-
}
|
|
796
|
-
}));
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
RawPureToolbar.__initStatic3();
|
|
800
|
-
const styles$1 = () => ({
|
|
801
|
-
pureToolbar: {
|
|
802
|
-
display: 'flex',
|
|
803
|
-
width: '100%',
|
|
804
|
-
zIndex: 8,
|
|
805
|
-
alignItems: 'center'
|
|
806
|
-
}
|
|
807
|
-
});
|
|
808
|
-
const PureToolbar = withStyles$2(styles$1)(RawPureToolbar);
|
|
809
|
-
const React$2 = _dll_react;
|
|
810
|
-
const cx$1 = _dll_classnames;
|
|
811
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
812
|
-
const PropTypes$1 = _dll_prop_types;
|
|
813
|
-
const {color: color$1} = _dll_pie_lib__render_ui;
|
|
814
|
-
const {mq: mq$1} = _dll_pie_lib__math_input;
|
|
815
|
-
const _jsxFileName$1 = "/home/circleci/repo/packages/math-inline/src/simple-question-block.jsx";
|
|
816
|
-
class SimpleQuestionBlockRaw extends React$2.Component {
|
|
817
|
-
constructor(...args) {
|
|
818
|
-
super(...args);
|
|
819
|
-
SimpleQuestionBlockRaw.prototype.__init.call(this);
|
|
820
|
-
SimpleQuestionBlockRaw.prototype.__init2.call(this);
|
|
821
|
-
SimpleQuestionBlockRaw.prototype.__init3.call(this);
|
|
822
|
-
}
|
|
823
|
-
static __initStatic() {
|
|
824
|
-
this.propTypes = {
|
|
825
|
-
classes: PropTypes$1.object,
|
|
826
|
-
onSimpleResponseChange: PropTypes$1.func,
|
|
827
|
-
model: PropTypes$1.object.isRequired,
|
|
828
|
-
emptyResponse: PropTypes$1.bool,
|
|
829
|
-
session: PropTypes$1.object.isRequired,
|
|
830
|
-
showCorrect: PropTypes$1.bool
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
__init() {
|
|
834
|
-
this.state = {
|
|
835
|
-
showKeypad: true
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
__init2() {
|
|
839
|
-
this.onFocus = () => this.setState({
|
|
840
|
-
showKeypad: true
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
__init3() {
|
|
844
|
-
this.onBlur = e => {
|
|
845
|
-
const {relatedTarget, currentTarget} = e || ({});
|
|
846
|
-
if (!relatedTarget || !currentTarget || relatedTarget.offsetParent !== currentTarget.offsetParent) {
|
|
847
|
-
this.setState({
|
|
848
|
-
showKeypad: false
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
render() {
|
|
854
|
-
const {classes, model, showCorrect, session, emptyResponse, onSimpleResponseChange} = this.props;
|
|
855
|
-
const {config, disabled, correctness, view} = model || ({});
|
|
856
|
-
if (!config) {
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
const correct = correctness && correctness.correct;
|
|
860
|
-
const {responses, equationEditor} = config;
|
|
861
|
-
return React$2.createElement('div', {
|
|
862
|
-
className: classes.expression,
|
|
863
|
-
__self: this,
|
|
864
|
-
__source: {
|
|
865
|
-
fileName: _jsxFileName$1,
|
|
866
|
-
lineNumber: 54
|
|
867
|
-
}
|
|
868
|
-
}, showCorrect || disabled ? React$2.createElement('div', {
|
|
869
|
-
className: cx$1(classes.static, {
|
|
870
|
-
[classes.incorrect]: !emptyResponse && !correct && !showCorrect,
|
|
871
|
-
[classes.correct]: !emptyResponse && (correct || showCorrect)
|
|
872
|
-
}),
|
|
873
|
-
__self: this,
|
|
874
|
-
__source: {
|
|
875
|
-
fileName: _jsxFileName$1,
|
|
876
|
-
lineNumber: 56
|
|
877
|
-
}
|
|
878
|
-
}, React$2.createElement(mq$1.Static, {
|
|
879
|
-
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || '',
|
|
880
|
-
__self: this,
|
|
881
|
-
__source: {
|
|
882
|
-
fileName: _jsxFileName$1,
|
|
883
|
-
lineNumber: 62
|
|
884
|
-
}
|
|
885
|
-
})) : React$2.createElement(MathToolbar, {
|
|
886
|
-
classNames: {
|
|
887
|
-
editor: classes.responseEditor
|
|
888
|
-
},
|
|
889
|
-
latex: session.response || '',
|
|
890
|
-
keypadMode: equationEditor,
|
|
891
|
-
onChange: onSimpleResponseChange,
|
|
892
|
-
onDone: () => {},
|
|
893
|
-
onFocus: this.onFocus,
|
|
894
|
-
onBlur: this.onBlur,
|
|
895
|
-
controlledKeypad: true,
|
|
896
|
-
showKeypad: this.state.showKeypad,
|
|
897
|
-
hideDoneButton: true,
|
|
898
|
-
__self: this,
|
|
899
|
-
__source: {
|
|
900
|
-
fileName: _jsxFileName$1,
|
|
901
|
-
lineNumber: 69
|
|
902
|
-
}
|
|
903
|
-
}));
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
SimpleQuestionBlockRaw.__initStatic();
|
|
907
|
-
const SimpleQuestionBlock = withStyles$1(theme => ({
|
|
908
|
-
responseEditor: {
|
|
909
|
-
display: 'flex',
|
|
910
|
-
justifyContent: 'center',
|
|
911
|
-
width: 'auto',
|
|
912
|
-
maxWidth: 'fit-content',
|
|
913
|
-
height: 'auto',
|
|
914
|
-
textAlign: 'left',
|
|
915
|
-
padding: theme.spacing.unit,
|
|
916
|
-
'&.mq-math-mode': {
|
|
917
|
-
border: `1px solid ${color$1.primaryLight()}`
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
expression: {
|
|
921
|
-
marginTop: theme.spacing.unit * 2,
|
|
922
|
-
marginBottom: theme.spacing.unit * 2,
|
|
923
|
-
padding: theme.spacing.unit
|
|
924
|
-
},
|
|
925
|
-
static: {
|
|
926
|
-
color: color$1.text(),
|
|
927
|
-
background: color$1.background(),
|
|
928
|
-
border: `1px solid ${color$1.primaryLight()}`,
|
|
929
|
-
width: 'fit-content',
|
|
930
|
-
fontSize: '1rem',
|
|
931
|
-
padding: theme.spacing.unit / 2,
|
|
932
|
-
'& > .mq-math-mode': {
|
|
933
|
-
'& > .mq-hasCursor': {
|
|
934
|
-
'& > .mq-cursor': {
|
|
935
|
-
display: 'none'
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
correct: {
|
|
941
|
-
border: `2px solid ${color$1.correct()} !important`,
|
|
942
|
-
padding: theme.spacing.unit,
|
|
943
|
-
letterSpacing: '0.5px'
|
|
944
|
-
},
|
|
945
|
-
incorrect: {
|
|
946
|
-
border: `2px solid ${color$1.incorrect()} !important`,
|
|
947
|
-
padding: theme.spacing.unit,
|
|
948
|
-
letterSpacing: '0.5px'
|
|
949
|
-
}
|
|
950
|
-
}))(SimpleQuestionBlockRaw);
|
|
951
|
-
const React$1 = _dll_react;
|
|
952
|
-
const PropTypes = _dll_prop_types;
|
|
953
|
-
const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
|
|
954
|
-
const {Feedback: Feedback} = _dll_pie_lib__render_ui;
|
|
955
|
-
const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
|
|
956
|
-
const {Readable: Readable} = _dll_pie_lib__render_ui;
|
|
957
|
-
const {hasText: hasText} = _dll_pie_lib__render_ui;
|
|
958
|
-
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__render_ui;
|
|
959
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
960
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
961
|
-
const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
962
|
-
const {isEqual: isEqual} = _dll_lodash;
|
|
963
|
-
const {isEmpty: isEmpty} = _dll_lodash;
|
|
964
|
-
const cx = _dll_classnames;
|
|
965
|
-
const {mq: mq} = _dll_pie_lib__math_input;
|
|
966
|
-
const {HorizontalKeypad: HorizontalKeypad} = _dll_pie_lib__math_input;
|
|
967
|
-
const {updateSpans: updateSpans} = _dll_pie_lib__math_input;
|
|
968
|
-
const MathQuill = _dll_pie_framework__mathquill;
|
|
969
|
-
const {renderMath: renderMath$1} = _dll_pie_lib__math_rendering;
|
|
970
|
-
const _jsxFileName = "/home/circleci/repo/packages/math-inline/src/main.jsx";
|
|
971
|
-
function _optionalChain(ops) {
|
|
972
|
-
let lastAccessLHS = undefined;
|
|
973
|
-
let value = ops[0];
|
|
974
|
-
let i = 1;
|
|
975
|
-
while (i < ops.length) {
|
|
976
|
-
const op = ops[i];
|
|
977
|
-
const fn = ops[i + 1];
|
|
978
|
-
i += 2;
|
|
979
|
-
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
980
|
-
return undefined;
|
|
981
|
-
}
|
|
982
|
-
if (op === 'access' || op === 'optionalAccess') {
|
|
983
|
-
lastAccessLHS = value;
|
|
984
|
-
value = fn(value);
|
|
985
|
-
} else if (op === 'call' || op === 'optionalCall') {
|
|
986
|
-
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
987
|
-
lastAccessLHS = undefined;
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
return value;
|
|
991
|
-
}
|
|
992
|
-
let registered = false;
|
|
993
|
-
const NEWLINE_LATEX = /\\newline/g;
|
|
994
|
-
const REGEX = /{{response}}/gm;
|
|
995
|
-
const DEFAULT_KEYPAD_VARIANT = 6;
|
|
996
|
-
const IS_SAFARI = (/^((?!chrome|android).)*safari/i).test(navigator.userAgent);
|
|
997
|
-
function generateAdditionalKeys(keyData = []) {
|
|
998
|
-
return keyData.map(key => ({
|
|
999
|
-
name: key,
|
|
1000
|
-
latex: key,
|
|
1001
|
-
write: key,
|
|
1002
|
-
label: key
|
|
1003
|
-
}));
|
|
1004
|
-
}
|
|
1005
|
-
function getKeyPadWidth(additionalKeys = [], equationEditor) {
|
|
1006
|
-
return Math.floor(additionalKeys.length / 5) * 30 + (equationEditor === 'miscellaneous' ? 600 : 500);
|
|
1007
|
-
}
|
|
1008
|
-
function prepareForStatic(model, state) {
|
|
1009
|
-
const {config, disabled} = model || ({});
|
|
1010
|
-
const {expression, responses, printMode, alwaysShowCorrect} = config || ({});
|
|
1011
|
-
if (config && expression) {
|
|
1012
|
-
const modelExpression = expression;
|
|
1013
|
-
if (state.showCorrect) {
|
|
1014
|
-
return responses && responses.length && responses[0].answer;
|
|
1015
|
-
}
|
|
1016
|
-
let answerBlocks = 1;
|
|
1017
|
-
return (modelExpression || '').replace(REGEX, function () {
|
|
1018
|
-
const answer = state.session.answers[`r${answerBlocks}`];
|
|
1019
|
-
if (printMode && !alwaysShowCorrect) {
|
|
1020
|
-
const blankSpace = ('\\ \\ ').repeat(30) + '\\newline ';
|
|
1021
|
-
return `\\MathQuillMathField[r${answerBlocks++}]{${blankSpace.repeat(3)}}`;
|
|
1022
|
-
}
|
|
1023
|
-
if (disabled) {
|
|
1024
|
-
return `\\embed{answerBlock}[r${answerBlocks++}]`;
|
|
1025
|
-
}
|
|
1026
|
-
return `\\MathQuillMathField[r${answerBlocks++}]{${answer && answer.value || ''}}`;
|
|
1027
|
-
}).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
class Main extends React$1.Component {
|
|
1031
|
-
static __initStatic() {
|
|
1032
|
-
this.propTypes = {
|
|
1033
|
-
classes: PropTypes.object,
|
|
1034
|
-
session: PropTypes.object.isRequired,
|
|
1035
|
-
onSessionChange: PropTypes.func,
|
|
1036
|
-
model: PropTypes.object.isRequired
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
constructor(props) {
|
|
1040
|
-
super(props);
|
|
1041
|
-
Main.prototype.__init.call(this);
|
|
1042
|
-
Main.prototype.__init2.call(this);
|
|
1043
|
-
Main.prototype.__init3.call(this);
|
|
1044
|
-
Main.prototype.__init4.call(this);
|
|
1045
|
-
Main.prototype.__init5.call(this);
|
|
1046
|
-
Main.prototype.__init6.call(this);
|
|
1047
|
-
Main.prototype.__init7.call(this);
|
|
1048
|
-
Main.prototype.__init8.call(this);
|
|
1049
|
-
Main.prototype.__init9.call(this);
|
|
1050
|
-
Main.prototype.__init10.call(this);
|
|
1051
|
-
Main.prototype.__init11.call(this);
|
|
1052
|
-
Main.prototype.__init12.call(this);
|
|
1053
|
-
const answers = {};
|
|
1054
|
-
if (props.model.config && props.model.config.expression) {
|
|
1055
|
-
let answerBlocks = 1;
|
|
1056
|
-
(props.model.config.expression || '').replace(REGEX, () => {
|
|
1057
|
-
answers[`r${answerBlocks}`] = {
|
|
1058
|
-
value: props.session && props.session.answers && props.session.answers[`r${answerBlocks}`] && props.session.answers[`r${answerBlocks}`].value || ''
|
|
1059
|
-
};
|
|
1060
|
-
answerBlocks += 1;
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
this.state = {
|
|
1064
|
-
session: {
|
|
1065
|
-
...props.session,
|
|
1066
|
-
answers
|
|
1067
|
-
},
|
|
1068
|
-
activeAnswerBlock: '',
|
|
1069
|
-
showCorrect: this.props.model.config.alwaysShowCorrect || false
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
UNSAFE_componentWillMount() {
|
|
1073
|
-
const {classes} = this.props;
|
|
1074
|
-
if (typeof window !== 'undefined') {
|
|
1075
|
-
let MQ = MathQuill.getInterface(2);
|
|
1076
|
-
if (!registered) {
|
|
1077
|
-
MQ.registerEmbed('answerBlock', data => {
|
|
1078
|
-
return {
|
|
1079
|
-
htmlString: `<div class="${classes.blockContainer}">
|
|
1080
|
-
<div class="${classes.blockResponse}" id="${data}Index">R</div>
|
|
1081
|
-
<div class="${classes.blockMath}">
|
|
1082
|
-
<span id="${data}"></span>
|
|
1083
|
-
</div>
|
|
1084
|
-
</div>`,
|
|
1085
|
-
text: () => 'text',
|
|
1086
|
-
latex: () => `\\embed{answerBlock}[${data}]`
|
|
1087
|
-
};
|
|
1088
|
-
});
|
|
1089
|
-
registered = true;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
__init() {
|
|
1094
|
-
this.handleAnswerBlockDomUpdate = () => {
|
|
1095
|
-
const {model, classes} = this.props;
|
|
1096
|
-
const {session, showCorrect} = this.state;
|
|
1097
|
-
const answers = session.answers;
|
|
1098
|
-
if (this.root && model.disabled && !showCorrect) {
|
|
1099
|
-
Object.keys(answers).forEach(answerId => {
|
|
1100
|
-
const el = this.root.querySelector(`#${answerId}`);
|
|
1101
|
-
const indexEl = this.root.querySelector(`#${answerId}Index`);
|
|
1102
|
-
if (el) {
|
|
1103
|
-
let MQ = MathQuill.getInterface(2);
|
|
1104
|
-
const answer = answers[answerId];
|
|
1105
|
-
el.textContent = answer && answer.value || '';
|
|
1106
|
-
if (!model.view) ; else {
|
|
1107
|
-
el.parentElement.parentElement.classList.remove(classes.correct);
|
|
1108
|
-
el.parentElement.parentElement.classList.remove(classes.incorrect);
|
|
1109
|
-
}
|
|
1110
|
-
MQ.StaticMath(el);
|
|
1111
|
-
indexEl.textContent = 'R';
|
|
1112
|
-
}
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
renderMath$1(this.root);
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
componentDidUpdate() {
|
|
1119
|
-
this.handleAnswerBlockDomUpdate();
|
|
1120
|
-
}
|
|
1121
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
1122
|
-
const {config} = this.props.model;
|
|
1123
|
-
const {config: nextConfig = {}} = nextProps.model || ({});
|
|
1124
|
-
if (config.env && config.env.mode !== 'evaluate' || nextConfig.env && nextConfig.env.mode !== 'evaluate') {
|
|
1125
|
-
this.setState({
|
|
1126
|
-
...this.state.session,
|
|
1127
|
-
showCorrect: false
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
if (nextConfig.alwaysShowCorrect) {
|
|
1131
|
-
this.setState({
|
|
1132
|
-
showCorrect: true
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
if (config && config.responses && config.responses.length !== nextConfig.responses.length || !config && nextConfig && nextConfig.responses || config && nextConfig && config.expression !== nextConfig.expression) {
|
|
1136
|
-
const newAnswers = {};
|
|
1137
|
-
const answers = this.state.session.answers;
|
|
1138
|
-
let answerBlocks = 1;
|
|
1139
|
-
(nextConfig.expression || '').replace(REGEX, () => {
|
|
1140
|
-
newAnswers[`r${answerBlocks}`] = {
|
|
1141
|
-
value: answers && answers[`r${answerBlocks}`] && answers[`r${answerBlocks}`].value || ''
|
|
1142
|
-
};
|
|
1143
|
-
answerBlocks++;
|
|
1144
|
-
});
|
|
1145
|
-
this.setState(state => ({
|
|
1146
|
-
session: {
|
|
1147
|
-
...state.session,
|
|
1148
|
-
completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),
|
|
1149
|
-
answers: newAnswers
|
|
1150
|
-
}
|
|
1151
|
-
}), this.handleAnswerBlockDomUpdate);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
1155
|
-
const sameModel = isEqual(this.props.model, nextProps.model);
|
|
1156
|
-
const sameState = isEqual(this.state, nextState);
|
|
1157
|
-
return !sameModel || !sameState;
|
|
1158
|
-
}
|
|
1159
|
-
componentDidMount() {
|
|
1160
|
-
this.handleAnswerBlockDomUpdate();
|
|
1161
|
-
setTimeout(() => renderMath$1(this.root), 100);
|
|
1162
|
-
}
|
|
1163
|
-
__init2() {
|
|
1164
|
-
this.onDone = () => {};
|
|
1165
|
-
}
|
|
1166
|
-
__init3() {
|
|
1167
|
-
this.onSimpleResponseChange = response => {
|
|
1168
|
-
this.setState(state => ({
|
|
1169
|
-
session: {
|
|
1170
|
-
...state.session,
|
|
1171
|
-
response
|
|
1172
|
-
}
|
|
1173
|
-
}), this.callOnSessionChange);
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
__init4() {
|
|
1177
|
-
this.onSubFieldFocus = id => {
|
|
1178
|
-
this.setState({
|
|
1179
|
-
activeAnswerBlock: id
|
|
1180
|
-
});
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
1183
|
-
__init5() {
|
|
1184
|
-
this.toNodeData = data => {
|
|
1185
|
-
if (!data) {
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
const {type, value} = data;
|
|
1189
|
-
if (type === 'command' || type === 'cursor') {
|
|
1190
|
-
return data;
|
|
1191
|
-
} else if (type === 'answer') {
|
|
1192
|
-
return {
|
|
1193
|
-
type: 'answer',
|
|
1194
|
-
...data
|
|
1195
|
-
};
|
|
1196
|
-
} else if (value === 'clear') {
|
|
1197
|
-
return {
|
|
1198
|
-
type: 'clear'
|
|
1199
|
-
};
|
|
1200
|
-
} else {
|
|
1201
|
-
return {
|
|
1202
|
-
type: 'write',
|
|
1203
|
-
value
|
|
1204
|
-
};
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
}
|
|
1208
|
-
__init6() {
|
|
1209
|
-
this.setInput = input => {
|
|
1210
|
-
this.input = input;
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
__init7() {
|
|
1214
|
-
this.onClick = data => {
|
|
1215
|
-
const c = this.toNodeData(data);
|
|
1216
|
-
if (c.type === 'clear') {
|
|
1217
|
-
this.input.clear();
|
|
1218
|
-
} else if (c.type === 'command') {
|
|
1219
|
-
if (Array.isArray(c.value)) {
|
|
1220
|
-
c.value.forEach(vv => {
|
|
1221
|
-
this.input.cmd(vv);
|
|
1222
|
-
});
|
|
1223
|
-
} else {
|
|
1224
|
-
this.input.cmd(c.value);
|
|
1225
|
-
}
|
|
1226
|
-
} else if (c.type === 'cursor') {
|
|
1227
|
-
this.input.keystroke(c.value);
|
|
1228
|
-
} else {
|
|
1229
|
-
this.input.write(c.value);
|
|
1230
|
-
}
|
|
1231
|
-
this.input.focus();
|
|
1232
|
-
};
|
|
1233
|
-
}
|
|
1234
|
-
__init8() {
|
|
1235
|
-
this.callOnSessionChange = () => {
|
|
1236
|
-
const {onSessionChange} = this.props;
|
|
1237
|
-
if (onSessionChange) {
|
|
1238
|
-
onSessionChange(this.state.session);
|
|
1239
|
-
}
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
__init9() {
|
|
1243
|
-
this.toggleShowCorrect = show => {
|
|
1244
|
-
this.setState({
|
|
1245
|
-
showCorrect: show
|
|
1246
|
-
}, this.handleAnswerBlockDomUpdate);
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
1249
|
-
__init10() {
|
|
1250
|
-
this.subFieldChanged = (name, subfieldValue) => {
|
|
1251
|
-
updateSpans();
|
|
1252
|
-
if (name) {
|
|
1253
|
-
this.setState(state => ({
|
|
1254
|
-
session: {
|
|
1255
|
-
...state.session,
|
|
1256
|
-
completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),
|
|
1257
|
-
answers: {
|
|
1258
|
-
...state.session.answers,
|
|
1259
|
-
[name]: {
|
|
1260
|
-
value: subfieldValue
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
}), this.callOnSessionChange);
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
__init11() {
|
|
1269
|
-
this.getFieldName = (changeField, fields) => {
|
|
1270
|
-
const {answers} = this.state.session;
|
|
1271
|
-
if (Object.keys(answers || ({})).length) {
|
|
1272
|
-
const keys = Object.keys(answers);
|
|
1273
|
-
return keys.find(k => {
|
|
1274
|
-
const tf = fields[k];
|
|
1275
|
-
return tf && tf.id == changeField.id;
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
__init12() {
|
|
1281
|
-
this.onBlur = e => {
|
|
1282
|
-
const {relatedTarget, currentTarget} = e || ({});
|
|
1283
|
-
if (!relatedTarget || !currentTarget || !IS_SAFARI && !_optionalChain([relatedTarget, 'optionalAccess', _13 => _13.offsetParent, 'optionalAccess', _14 => _14.children, 'access', _15 => _15[0], 'optionalAccess', _16 => _16.attributes, 'optionalAccess', _17 => _17['data-keypad']]) || IS_SAFARI && !_optionalChain([relatedTarget, 'optionalAccess', _18 => _18.offsetParent, 'optionalAccess', _19 => _19.children, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.children, 'access', _22 => _22[0], 'optionalAccess', _23 => _23.attributes, 'optionalAccess', _24 => _24['data-keypad']])) {
|
|
1284
|
-
this.setState({
|
|
1285
|
-
activeAnswerBlock: ''
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
setTooltipRef(ref) {
|
|
1291
|
-
setTimeout(() => {
|
|
1292
|
-
if (ref && IS_SAFARI) {
|
|
1293
|
-
const div = document.querySelector('[role=\'tooltip\']');
|
|
1294
|
-
if (div) {
|
|
1295
|
-
const el = div.firstChild;
|
|
1296
|
-
el.setAttribute('tabindex', '-1');
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
}, 1);
|
|
1300
|
-
}
|
|
1301
|
-
render() {
|
|
1302
|
-
const {model, classes} = this.props;
|
|
1303
|
-
const {activeAnswerBlock, showCorrect, session} = this.state;
|
|
1304
|
-
const {config, correctness, disabled, view, teacherInstructions, rationale, feedback, animationsDisabled, printMode, alwaysShowCorrect} = model || ({});
|
|
1305
|
-
if (!config) {
|
|
1306
|
-
return null;
|
|
1307
|
-
}
|
|
1308
|
-
const {showNote, note, prompt, responses, responseType, equationEditor, customKeys, env: {mode, role} = {}} = config || ({});
|
|
1309
|
-
const displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note;
|
|
1310
|
-
const emptyResponse = isEmpty(responses);
|
|
1311
|
-
const showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';
|
|
1312
|
-
const tooltipModeEnabled = disabled && correctness;
|
|
1313
|
-
const additionalKeys = generateAdditionalKeys(customKeys);
|
|
1314
|
-
const correct = correctness && correctness.correct;
|
|
1315
|
-
const staticLatex = prepareForStatic(model, this.state) || '';
|
|
1316
|
-
const viewMode = disabled && !correctness;
|
|
1317
|
-
const studentPrintMode = printMode && !alwaysShowCorrect;
|
|
1318
|
-
const printView = React$1.createElement('div', {
|
|
1319
|
-
className: classes.printContainer,
|
|
1320
|
-
__self: this,
|
|
1321
|
-
__source: {
|
|
1322
|
-
fileName: _jsxFileName,
|
|
1323
|
-
lineNumber: 411
|
|
1324
|
-
}
|
|
1325
|
-
}, React$1.createElement(mq.Static, {
|
|
1326
|
-
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
1327
|
-
latex: staticLatex,
|
|
1328
|
-
onSubFieldChange: this.subFieldChanged,
|
|
1329
|
-
getFieldName: this.getFieldName,
|
|
1330
|
-
setInput: this.setInput,
|
|
1331
|
-
onSubFieldFocus: this.onSubFieldFocus,
|
|
1332
|
-
onBlur: this.onBlur,
|
|
1333
|
-
__self: this,
|
|
1334
|
-
__source: {
|
|
1335
|
-
fileName: _jsxFileName,
|
|
1336
|
-
lineNumber: 412
|
|
1337
|
-
}
|
|
1338
|
-
}));
|
|
1339
|
-
const midContent = React$1.createElement('div', {
|
|
1340
|
-
className: classes.main,
|
|
1341
|
-
__self: this,
|
|
1342
|
-
__source: {
|
|
1343
|
-
fileName: _jsxFileName,
|
|
1344
|
-
lineNumber: 424
|
|
1345
|
-
}
|
|
1346
|
-
}, prompt && React$1.createElement('div', {
|
|
1347
|
-
className: classes.content,
|
|
1348
|
-
__self: this,
|
|
1349
|
-
__source: {
|
|
1350
|
-
fileName: _jsxFileName,
|
|
1351
|
-
lineNumber: 426
|
|
1352
|
-
}
|
|
1353
|
-
}, React$1.createElement(PreviewPrompt, {
|
|
1354
|
-
prompt: prompt,
|
|
1355
|
-
__self: this,
|
|
1356
|
-
__source: {
|
|
1357
|
-
fileName: _jsxFileName,
|
|
1358
|
-
lineNumber: 427
|
|
1359
|
-
}
|
|
1360
|
-
})), studentPrintMode ? printView : React$1.createElement(Readable, {
|
|
1361
|
-
false: true,
|
|
1362
|
-
__self: this,
|
|
1363
|
-
__source: {
|
|
1364
|
-
fileName: _jsxFileName,
|
|
1365
|
-
lineNumber: 430
|
|
1366
|
-
}
|
|
1367
|
-
}, React$1.createElement('div', {
|
|
1368
|
-
className: classes.inputAndKeypadContainer,
|
|
1369
|
-
__self: this,
|
|
1370
|
-
__source: {
|
|
1371
|
-
fileName: _jsxFileName,
|
|
1372
|
-
lineNumber: 431
|
|
1373
|
-
}
|
|
1374
|
-
}, responseType === ResponseTypes.simple && React$1.createElement(SimpleQuestionBlock, {
|
|
1375
|
-
onSimpleResponseChange: this.onSimpleResponseChange,
|
|
1376
|
-
showCorrect: showCorrect,
|
|
1377
|
-
emptyResponse: emptyResponse,
|
|
1378
|
-
model: model,
|
|
1379
|
-
session: session,
|
|
1380
|
-
__self: this,
|
|
1381
|
-
__source: {
|
|
1382
|
-
fileName: _jsxFileName,
|
|
1383
|
-
lineNumber: 433
|
|
1384
|
-
}
|
|
1385
|
-
}), responseType === ResponseTypes.advanced && React$1.createElement('div', {
|
|
1386
|
-
className: cx(classes.expression, {
|
|
1387
|
-
[classes.incorrect]: !emptyResponse && !correct && !showCorrect,
|
|
1388
|
-
[classes.correct]: !emptyResponse && (correct || showCorrect),
|
|
1389
|
-
[classes.showCorrectness]: !emptyResponse && disabled && correctness && !view,
|
|
1390
|
-
[classes.correctAnswerShown]: showCorrect,
|
|
1391
|
-
[classes.printCorrect]: printMode && alwaysShowCorrect
|
|
1392
|
-
}),
|
|
1393
|
-
__self: this,
|
|
1394
|
-
__source: {
|
|
1395
|
-
fileName: _jsxFileName,
|
|
1396
|
-
lineNumber: 442
|
|
1397
|
-
}
|
|
1398
|
-
}, React$1.createElement(Tooltip, {
|
|
1399
|
-
ref: ref => this.setTooltipRef(ref),
|
|
1400
|
-
interactive: true,
|
|
1401
|
-
open: !!activeAnswerBlock,
|
|
1402
|
-
classes: {
|
|
1403
|
-
tooltip: classes.keypadTooltip,
|
|
1404
|
-
popper: classes.keypadTooltipPopper
|
|
1405
|
-
},
|
|
1406
|
-
title: Object.keys(session.answers).map(answerId => answerId === activeAnswerBlock && !(showCorrect || disabled) && React$1.createElement('div', {
|
|
1407
|
-
'data-keypad': true,
|
|
1408
|
-
key: answerId,
|
|
1409
|
-
className: classes.responseContainer,
|
|
1410
|
-
style: {
|
|
1411
|
-
width: getKeyPadWidth(additionalKeys, equationEditor)
|
|
1412
|
-
},
|
|
1413
|
-
__self: this,
|
|
1414
|
-
__source: {
|
|
1415
|
-
fileName: _jsxFileName,
|
|
1416
|
-
lineNumber: 463
|
|
1417
|
-
}
|
|
1418
|
-
}, React$1.createElement(HorizontalKeypad, {
|
|
1419
|
-
additionalKeys: additionalKeys,
|
|
1420
|
-
mode: equationEditor || DEFAULT_KEYPAD_VARIANT,
|
|
1421
|
-
onClick: this.onClick,
|
|
1422
|
-
__self: this,
|
|
1423
|
-
__source: {
|
|
1424
|
-
fileName: _jsxFileName,
|
|
1425
|
-
lineNumber: 472
|
|
1426
|
-
}
|
|
1427
|
-
})) || null),
|
|
1428
|
-
__self: this,
|
|
1429
|
-
__source: {
|
|
1430
|
-
fileName: _jsxFileName,
|
|
1431
|
-
lineNumber: 451
|
|
1432
|
-
}
|
|
1433
|
-
}, React$1.createElement(mq.Static, {
|
|
1434
|
-
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
1435
|
-
latex: staticLatex,
|
|
1436
|
-
onSubFieldChange: this.subFieldChanged,
|
|
1437
|
-
getFieldName: this.getFieldName,
|
|
1438
|
-
setInput: this.setInput,
|
|
1439
|
-
onSubFieldFocus: this.onSubFieldFocus,
|
|
1440
|
-
onBlur: this.onBlur,
|
|
1441
|
-
__self: this,
|
|
1442
|
-
__source: {
|
|
1443
|
-
fileName: _jsxFileName,
|
|
1444
|
-
lineNumber: 482
|
|
1445
|
-
}
|
|
1446
|
-
}))))), viewMode && teacherInstructions && hasText(teacherInstructions) && React$1.createElement(React$1.Fragment, {
|
|
1447
|
-
__self: this,
|
|
1448
|
-
__source: {
|
|
1449
|
-
fileName: _jsxFileName,
|
|
1450
|
-
lineNumber: 498
|
|
1451
|
-
}
|
|
1452
|
-
}, !animationsDisabled ? React$1.createElement(Collapsible, {
|
|
1453
|
-
labels: {
|
|
1454
|
-
hidden: 'Show Teacher Instructions',
|
|
1455
|
-
visible: 'Hide Teacher Instructions'
|
|
1456
|
-
},
|
|
1457
|
-
__self: this,
|
|
1458
|
-
__source: {
|
|
1459
|
-
fileName: _jsxFileName,
|
|
1460
|
-
lineNumber: 499
|
|
1461
|
-
}
|
|
1462
|
-
}, React$1.createElement('div', {
|
|
1463
|
-
dangerouslySetInnerHTML: {
|
|
1464
|
-
__html: teacherInstructions
|
|
1465
|
-
},
|
|
1466
|
-
__self: this,
|
|
1467
|
-
__source: {
|
|
1468
|
-
fileName: _jsxFileName,
|
|
1469
|
-
lineNumber: 502
|
|
1470
|
-
}
|
|
1471
|
-
})) : React$1.createElement('div', {
|
|
1472
|
-
dangerouslySetInnerHTML: {
|
|
1473
|
-
__html: teacherInstructions
|
|
1474
|
-
},
|
|
1475
|
-
__self: this,
|
|
1476
|
-
__source: {
|
|
1477
|
-
fileName: _jsxFileName,
|
|
1478
|
-
lineNumber: 503
|
|
1479
|
-
}
|
|
1480
|
-
}), React$1.createElement('br', {
|
|
1481
|
-
__self: this,
|
|
1482
|
-
__source: {
|
|
1483
|
-
fileName: _jsxFileName,
|
|
1484
|
-
lineNumber: 504
|
|
1485
|
-
}
|
|
1486
|
-
})), viewMode && rationale && hasText(rationale) && React$1.createElement(React$1.Fragment, {
|
|
1487
|
-
__self: this,
|
|
1488
|
-
__source: {
|
|
1489
|
-
fileName: _jsxFileName,
|
|
1490
|
-
lineNumber: 510
|
|
1491
|
-
}
|
|
1492
|
-
}, !animationsDisabled ? React$1.createElement(Collapsible, {
|
|
1493
|
-
labels: {
|
|
1494
|
-
hidden: 'Show Rationale',
|
|
1495
|
-
visible: 'Hide Rationale'
|
|
1496
|
-
},
|
|
1497
|
-
__self: this,
|
|
1498
|
-
__source: {
|
|
1499
|
-
fileName: _jsxFileName,
|
|
1500
|
-
lineNumber: 511
|
|
1501
|
-
}
|
|
1502
|
-
}, React$1.createElement('div', {
|
|
1503
|
-
dangerouslySetInnerHTML: {
|
|
1504
|
-
__html: rationale
|
|
1505
|
-
},
|
|
1506
|
-
__self: this,
|
|
1507
|
-
__source: {
|
|
1508
|
-
fileName: _jsxFileName,
|
|
1509
|
-
lineNumber: 514
|
|
1510
|
-
}
|
|
1511
|
-
})) : React$1.createElement('div', {
|
|
1512
|
-
dangerouslySetInnerHTML: {
|
|
1513
|
-
__html: rationale
|
|
1514
|
-
},
|
|
1515
|
-
__self: this,
|
|
1516
|
-
__source: {
|
|
1517
|
-
fileName: _jsxFileName,
|
|
1518
|
-
lineNumber: 515
|
|
1519
|
-
}
|
|
1520
|
-
})), viewMode && displayNote && React$1.createElement('div', {
|
|
1521
|
-
className: classes.note,
|
|
1522
|
-
dangerouslySetInnerHTML: {
|
|
1523
|
-
__html: `<strong>Note:</strong> ${note}`
|
|
1524
|
-
},
|
|
1525
|
-
__self: this,
|
|
1526
|
-
__source: {
|
|
1527
|
-
fileName: _jsxFileName,
|
|
1528
|
-
lineNumber: 521
|
|
1529
|
-
}
|
|
1530
|
-
}));
|
|
1531
|
-
if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions || rationale || feedback)) {
|
|
1532
|
-
return React$1.createElement(Tooltip, {
|
|
1533
|
-
interactive: true,
|
|
1534
|
-
classes: {
|
|
1535
|
-
tooltip: classes.tooltip,
|
|
1536
|
-
popper: classes.tooltipPopper
|
|
1537
|
-
},
|
|
1538
|
-
title: React$1.createElement('div', {
|
|
1539
|
-
__self: this,
|
|
1540
|
-
__source: {
|
|
1541
|
-
fileName: _jsxFileName,
|
|
1542
|
-
lineNumber: 539
|
|
1543
|
-
}
|
|
1544
|
-
}, React$1.createElement('div', {
|
|
1545
|
-
className: classes.main,
|
|
1546
|
-
__self: this,
|
|
1547
|
-
__source: {
|
|
1548
|
-
fileName: _jsxFileName,
|
|
1549
|
-
lineNumber: 540
|
|
1550
|
-
}
|
|
1551
|
-
}, showCorrectAnswerToggle && React$1.createElement(CorrectAnswerToggle, {
|
|
1552
|
-
className: classes.toggle,
|
|
1553
|
-
show: true,
|
|
1554
|
-
toggled: showCorrect,
|
|
1555
|
-
onToggle: this.toggleShowCorrect,
|
|
1556
|
-
__self: this,
|
|
1557
|
-
__source: {
|
|
1558
|
-
fileName: _jsxFileName,
|
|
1559
|
-
lineNumber: 542
|
|
1560
|
-
}
|
|
1561
|
-
})), teacherInstructions && hasText(teacherInstructions) && [React$1.createElement(Collapsible, {
|
|
1562
|
-
key: "collapsible",
|
|
1563
|
-
labels: {
|
|
1564
|
-
hidden: 'Show Teacher Instructions',
|
|
1565
|
-
visible: 'Hide Teacher Instructions'
|
|
1566
|
-
},
|
|
1567
|
-
className: classes.collapsible,
|
|
1568
|
-
__self: this,
|
|
1569
|
-
__source: {
|
|
1570
|
-
fileName: _jsxFileName,
|
|
1571
|
-
lineNumber: 551
|
|
1572
|
-
}
|
|
1573
|
-
}, React$1.createElement(PreviewPrompt, {
|
|
1574
|
-
prompt: teacherInstructions,
|
|
1575
|
-
__self: this,
|
|
1576
|
-
__source: {
|
|
1577
|
-
fileName: _jsxFileName,
|
|
1578
|
-
lineNumber: 559
|
|
1579
|
-
}
|
|
1580
|
-
})), React$1.createElement('br', {
|
|
1581
|
-
key: "br",
|
|
1582
|
-
__self: this,
|
|
1583
|
-
__source: {
|
|
1584
|
-
fileName: _jsxFileName,
|
|
1585
|
-
lineNumber: 561
|
|
1586
|
-
}
|
|
1587
|
-
})], rationale && hasText(rationale) && [React$1.createElement(Collapsible, {
|
|
1588
|
-
key: "collapsible",
|
|
1589
|
-
labels: {
|
|
1590
|
-
hidden: 'Show Rationale',
|
|
1591
|
-
visible: 'Hide Rationale'
|
|
1592
|
-
},
|
|
1593
|
-
__self: this,
|
|
1594
|
-
__source: {
|
|
1595
|
-
fileName: _jsxFileName,
|
|
1596
|
-
lineNumber: 564
|
|
1597
|
-
}
|
|
1598
|
-
}, React$1.createElement(PreviewPrompt, {
|
|
1599
|
-
prompt: rationale,
|
|
1600
|
-
__self: this,
|
|
1601
|
-
__source: {
|
|
1602
|
-
fileName: _jsxFileName,
|
|
1603
|
-
lineNumber: 571
|
|
1604
|
-
}
|
|
1605
|
-
})), React$1.createElement('br', {
|
|
1606
|
-
key: "br",
|
|
1607
|
-
__self: this,
|
|
1608
|
-
__source: {
|
|
1609
|
-
fileName: _jsxFileName,
|
|
1610
|
-
lineNumber: 573
|
|
1611
|
-
}
|
|
1612
|
-
})], displayNote && hasText(note) && [React$1.createElement(Collapsible, {
|
|
1613
|
-
key: "collapsible",
|
|
1614
|
-
labels: {
|
|
1615
|
-
hidden: 'Show Note',
|
|
1616
|
-
visible: 'Hide Note'
|
|
1617
|
-
},
|
|
1618
|
-
__self: this,
|
|
1619
|
-
__source: {
|
|
1620
|
-
fileName: _jsxFileName,
|
|
1621
|
-
lineNumber: 576
|
|
1622
|
-
}
|
|
1623
|
-
}, React$1.createElement(PreviewPrompt, {
|
|
1624
|
-
prompt: note,
|
|
1625
|
-
__self: this,
|
|
1626
|
-
__source: {
|
|
1627
|
-
fileName: _jsxFileName,
|
|
1628
|
-
lineNumber: 583
|
|
1629
|
-
}
|
|
1630
|
-
})), React$1.createElement('br', {
|
|
1631
|
-
key: "br",
|
|
1632
|
-
__self: this,
|
|
1633
|
-
__source: {
|
|
1634
|
-
fileName: _jsxFileName,
|
|
1635
|
-
lineNumber: 585
|
|
1636
|
-
}
|
|
1637
|
-
})], feedback && React$1.createElement(Feedback, {
|
|
1638
|
-
correctness: correctness.correctness,
|
|
1639
|
-
feedback: feedback,
|
|
1640
|
-
__self: this,
|
|
1641
|
-
__source: {
|
|
1642
|
-
fileName: _jsxFileName,
|
|
1643
|
-
lineNumber: 588
|
|
1644
|
-
}
|
|
1645
|
-
})),
|
|
1646
|
-
__self: this,
|
|
1647
|
-
__source: {
|
|
1648
|
-
fileName: _jsxFileName,
|
|
1649
|
-
lineNumber: 532
|
|
1650
|
-
}
|
|
1651
|
-
}, React$1.createElement('div', {
|
|
1652
|
-
className: classes.mainContainer,
|
|
1653
|
-
ref: r => this.root = r || this.root,
|
|
1654
|
-
__self: this,
|
|
1655
|
-
__source: {
|
|
1656
|
-
fileName: _jsxFileName,
|
|
1657
|
-
lineNumber: 596
|
|
1658
|
-
}
|
|
1659
|
-
}, midContent));
|
|
1660
|
-
}
|
|
1661
|
-
return React$1.createElement('div', {
|
|
1662
|
-
className: classes.mainContainer,
|
|
1663
|
-
ref: r => this.root = r || this.root,
|
|
1664
|
-
__self: this,
|
|
1665
|
-
__source: {
|
|
1666
|
-
fileName: _jsxFileName,
|
|
1667
|
-
lineNumber: 606
|
|
1668
|
-
}
|
|
1669
|
-
}, midContent);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
Main.__initStatic();
|
|
1673
|
-
const styles = theme => ({
|
|
1674
|
-
mainContainer: {
|
|
1675
|
-
display: 'inline-block'
|
|
1676
|
-
},
|
|
1677
|
-
tooltip: {
|
|
1678
|
-
background: `${color.primaryLight()} !important`,
|
|
1679
|
-
color: color.text(),
|
|
1680
|
-
padding: theme.spacing.unit * 2,
|
|
1681
|
-
border: `1px solid ${color.secondary()}`,
|
|
1682
|
-
fontSize: '16px',
|
|
1683
|
-
'& :not(.MathJax) > table tr': {
|
|
1684
|
-
'&:nth-child(2n)': {
|
|
1685
|
-
backgroundColor: 'unset !important'
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
tooltipPopper: {
|
|
1690
|
-
opacity: 1
|
|
1691
|
-
},
|
|
1692
|
-
keypadTooltip: {
|
|
1693
|
-
fontSize: 'initial',
|
|
1694
|
-
background: 'transparent',
|
|
1695
|
-
width: '600px',
|
|
1696
|
-
marginTop: 0,
|
|
1697
|
-
paddingTop: 0
|
|
1698
|
-
},
|
|
1699
|
-
keypadTooltipPopper: {
|
|
1700
|
-
background: 'transparent',
|
|
1701
|
-
width: '650px',
|
|
1702
|
-
opacity: 1
|
|
1703
|
-
},
|
|
1704
|
-
main: {
|
|
1705
|
-
width: '100%',
|
|
1706
|
-
position: 'relative',
|
|
1707
|
-
padding: theme.spacing.unit / 2,
|
|
1708
|
-
backgroundColor: color.background(),
|
|
1709
|
-
color: color.text()
|
|
1710
|
-
},
|
|
1711
|
-
title: {
|
|
1712
|
-
fontSize: '1.1rem',
|
|
1713
|
-
display: 'block',
|
|
1714
|
-
marginTop: theme.spacing.unit * 2,
|
|
1715
|
-
marginBottom: theme.spacing.unit
|
|
1716
|
-
},
|
|
1717
|
-
content: {
|
|
1718
|
-
marginTop: theme.spacing.unit * 2
|
|
1719
|
-
},
|
|
1720
|
-
note: {
|
|
1721
|
-
paddingTop: '15px'
|
|
1722
|
-
},
|
|
1723
|
-
collapsible: {
|
|
1724
|
-
marginTop: theme.spacing.unit * 2
|
|
1725
|
-
},
|
|
1726
|
-
responseContainer: {
|
|
1727
|
-
zIndex: 10,
|
|
1728
|
-
minWidth: '400px',
|
|
1729
|
-
marginTop: theme.spacing.unit * 2
|
|
1730
|
-
},
|
|
1731
|
-
expression: {
|
|
1732
|
-
maxWidth: 'fit-content',
|
|
1733
|
-
'& > .mq-math-mode': {
|
|
1734
|
-
'& > .mq-root-block': {
|
|
1735
|
-
'& > .mq-editable-field': {
|
|
1736
|
-
minWidth: '10px',
|
|
1737
|
-
margin: theme.spacing.unit * 2 / 3,
|
|
1738
|
-
padding: theme.spacing.unit / 4
|
|
1739
|
-
}
|
|
1740
|
-
},
|
|
1741
|
-
'& sup': {
|
|
1742
|
-
top: 0
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
},
|
|
1746
|
-
inputAndKeypadContainer: {
|
|
1747
|
-
position: 'relative',
|
|
1748
|
-
'& .mq-overarrow-inner': {
|
|
1749
|
-
border: 'none !important',
|
|
1750
|
-
padding: '0 !important'
|
|
1751
|
-
},
|
|
1752
|
-
'& .mq-overarrow-inner-right': {
|
|
1753
|
-
display: 'none !important'
|
|
1754
|
-
},
|
|
1755
|
-
'& .mq-overarrow-inner-left': {
|
|
1756
|
-
display: 'none !important'
|
|
1757
|
-
},
|
|
1758
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
1759
|
-
minWidth: '1.23em',
|
|
1760
|
-
'& *': {
|
|
1761
|
-
lineHeight: '1 !important'
|
|
1762
|
-
},
|
|
1763
|
-
'&:before': {
|
|
1764
|
-
top: '-0.4em',
|
|
1765
|
-
left: '-1px'
|
|
1766
|
-
},
|
|
1767
|
-
'&:after': {
|
|
1768
|
-
top: '-2.4em',
|
|
1769
|
-
right: '-1px'
|
|
1770
|
-
},
|
|
1771
|
-
'&.mq-empty:after': {
|
|
1772
|
-
top: '-0.45em'
|
|
1773
|
-
}
|
|
1774
|
-
},
|
|
1775
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
1776
|
-
'&:before': {
|
|
1777
|
-
top: '-0.4em',
|
|
1778
|
-
right: '-1px'
|
|
1779
|
-
}
|
|
1780
|
-
},
|
|
1781
|
-
'& .mq-longdiv-inner': {
|
|
1782
|
-
borderTop: '1px solid !important',
|
|
1783
|
-
paddingTop: '1.5px !important'
|
|
1784
|
-
},
|
|
1785
|
-
'& .mq-parallelogram': {
|
|
1786
|
-
lineHeight: 0.85
|
|
1787
|
-
}
|
|
1788
|
-
},
|
|
1789
|
-
showCorrectness: {
|
|
1790
|
-
border: '2px solid'
|
|
1791
|
-
},
|
|
1792
|
-
correctAnswerShown: {
|
|
1793
|
-
padding: theme.spacing.unit,
|
|
1794
|
-
letterSpacing: '0.5px'
|
|
1795
|
-
},
|
|
1796
|
-
printCorrect: {
|
|
1797
|
-
border: `2px solid ${color.correct()} !important`
|
|
1798
|
-
},
|
|
1799
|
-
correct: {
|
|
1800
|
-
borderColor: `${color.correct()} !important`
|
|
1801
|
-
},
|
|
1802
|
-
incorrect: {
|
|
1803
|
-
borderColor: `${color.incorrect()} !important`
|
|
1804
|
-
},
|
|
1805
|
-
blockContainer: {
|
|
1806
|
-
margin: `${theme.spacing.unit}px !important`,
|
|
1807
|
-
display: 'inline-flex',
|
|
1808
|
-
border: '2px solid grey !important'
|
|
1809
|
-
},
|
|
1810
|
-
blockResponse: {
|
|
1811
|
-
flex: 2,
|
|
1812
|
-
color: 'grey',
|
|
1813
|
-
background: 'lightgrey',
|
|
1814
|
-
fontSize: '0.8rem !important',
|
|
1815
|
-
padding: `${theme.spacing.unit / 2}px !important`,
|
|
1816
|
-
display: 'flex',
|
|
1817
|
-
alignItems: 'center',
|
|
1818
|
-
justifyContent: 'center',
|
|
1819
|
-
borderRight: `2px solid ${color.disabled()} !important`
|
|
1820
|
-
},
|
|
1821
|
-
toggle: {
|
|
1822
|
-
color: color.text()
|
|
1823
|
-
},
|
|
1824
|
-
blockMath: {
|
|
1825
|
-
color: color.text(),
|
|
1826
|
-
backgroundColor: color.background(),
|
|
1827
|
-
padding: `${theme.spacing.unit / 2}px !important`,
|
|
1828
|
-
display: 'flex',
|
|
1829
|
-
alignItems: 'center',
|
|
1830
|
-
justifyContent: 'center',
|
|
1831
|
-
flex: 8,
|
|
1832
|
-
'& > .mq-math-mode': {
|
|
1833
|
-
'& > .mq-hasCursor': {
|
|
1834
|
-
'& > .mq-cursor': {
|
|
1835
|
-
display: 'none'
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
},
|
|
1840
|
-
printContainer: {
|
|
1841
|
-
marginBottom: '10px',
|
|
1842
|
-
pointerEvents: 'none'
|
|
1843
|
-
}
|
|
1844
|
-
});
|
|
1845
|
-
var Main$1 = withStyles(styles)(Main);
|
|
1846
|
-
const React = _dll_react;
|
|
1847
|
-
const ReactDOM = _dll_react_dom;
|
|
1848
|
-
const {debounce: debounce} = _dll_lodash;
|
|
1849
|
-
const debug = _dll_debug;
|
|
1850
|
-
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
1851
|
-
const log = debug('pie-element:math-inline:print');
|
|
1852
|
-
const preparePrintModel = (model, opts) => {
|
|
1853
|
-
const instr = opts.role === 'instructor';
|
|
1854
|
-
model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
|
|
1855
|
-
model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
|
|
1856
|
-
model.rationale = instr && model.rationaleEnabled !== false ? model.rationale : undefined;
|
|
1857
|
-
model.showTeacherInstructions = instr;
|
|
1858
|
-
model.alwaysShowCorrect = instr;
|
|
1859
|
-
model.printMode = true;
|
|
1860
|
-
model.feedback = undefined;
|
|
1861
|
-
model.expression = model.expression || '{{response}}';
|
|
1862
|
-
model.animationsDisabled = true;
|
|
1863
|
-
return {
|
|
1864
|
-
...model,
|
|
1865
|
-
disabled: true,
|
|
1866
|
-
config: {
|
|
1867
|
-
...model,
|
|
1868
|
-
env: {
|
|
1869
|
-
mode: instr ? 'evaluate' : model.mode,
|
|
1870
|
-
role: opts.role
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
};
|
|
1874
|
-
};
|
|
1875
|
-
class MathInlinePrint extends HTMLElement {
|
|
1876
|
-
constructor() {
|
|
1877
|
-
super();
|
|
1878
|
-
this._options = null;
|
|
1879
|
-
this._model = null;
|
|
1880
|
-
this._session = [];
|
|
1881
|
-
this._rerender = debounce(() => {
|
|
1882
|
-
if (this._model && this._session) {
|
|
1883
|
-
const printModel = preparePrintModel(this._model, this._options);
|
|
1884
|
-
const element = this._options && React.createElement(Main$1, {
|
|
1885
|
-
model: printModel,
|
|
1886
|
-
session: {}
|
|
1887
|
-
});
|
|
1888
|
-
ReactDOM.render(element, this, () => {
|
|
1889
|
-
log('render complete - render math');
|
|
1890
|
-
renderMath(this);
|
|
1891
|
-
});
|
|
1892
|
-
} else {
|
|
1893
|
-
log('skip');
|
|
1894
|
-
}
|
|
1895
|
-
}, 50, {
|
|
1896
|
-
leading: false,
|
|
1897
|
-
trailing: true
|
|
1898
|
-
});
|
|
1899
|
-
}
|
|
1900
|
-
set options(o) {
|
|
1901
|
-
this._options = o;
|
|
1902
|
-
}
|
|
1903
|
-
set model(s) {
|
|
1904
|
-
this._model = s;
|
|
1905
|
-
this._rerender();
|
|
1906
|
-
}
|
|
1907
|
-
connectedCallback() {}
|
|
1908
|
-
}
|
|
1909
|
-
export {MathInlinePrint as default};
|