@pie-element/math-inline 7.16.1-next.1 → 7.16.1-next.10
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/configure/lib/configure.js +262 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/defaults.js +176 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/general-config-block.js +653 -0
- package/configure/lib/general-config-block.js.map +1 -0
- package/configure/lib/index.js +201 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/response.js +431 -0
- package/configure/lib/response.js.map +1 -0
- package/configure/lib/utils.js +46 -0
- package/configure/lib/utils.js.map +1 -0
- package/controller/lib/defaults.js +34 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +437 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +12 -0
- package/controller/lib/utils.js.map +1 -0
- package/lib/index.js +130 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +947 -0
- package/lib/main.js.map +1 -0
- package/lib/print.js +133 -0
- package/lib/print.js.map +1 -0
- package/lib/simple-question-block.js +195 -0
- package/lib/simple-question-block.js.map +1 -0
- package/lib/utils.js +12 -0
- package/lib/utils.js.map +1 -0
- package/package.json +2 -2
package/lib/main.js
ADDED
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.Main = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
+
|
|
28
|
+
var _correctAnswerToggle = require("@pie-lib/pie-toolbox/correct-answer-toggle");
|
|
29
|
+
|
|
30
|
+
var _mathInput = require("@pie-lib/pie-toolbox/math-input");
|
|
31
|
+
|
|
32
|
+
var _renderUi = require("@pie-lib/pie-toolbox/render-ui");
|
|
33
|
+
|
|
34
|
+
var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
|
|
35
|
+
|
|
36
|
+
var _styles = require("@material-ui/core/styles");
|
|
37
|
+
|
|
38
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
39
|
+
|
|
40
|
+
var _utils = require("./utils");
|
|
41
|
+
|
|
42
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
43
|
+
|
|
44
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
45
|
+
|
|
46
|
+
var _simpleQuestionBlock = _interopRequireDefault(require("./simple-question-block"));
|
|
47
|
+
|
|
48
|
+
var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
49
|
+
|
|
50
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
51
|
+
|
|
52
|
+
var _translator = _interopRequireDefault(require("@pie-lib/pie-toolbox/translator"));
|
|
53
|
+
|
|
54
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
55
|
+
|
|
56
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
57
|
+
|
|
58
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
59
|
+
|
|
60
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
|
+
|
|
62
|
+
var translator = _translator["default"].translator;
|
|
63
|
+
var registered = false;
|
|
64
|
+
var NEWLINE_LATEX = /\\newline/g;
|
|
65
|
+
var REGEX = /{{response}}/gm;
|
|
66
|
+
var DEFAULT_KEYPAD_VARIANT = 6; // !!! If you're using Chrome but have selected the "iPad" device in Chrome Developer Tools, the navigator.userAgent string may still report as
|
|
67
|
+
// Safari because Chrome on iOS actually uses the Safari rendering engine under the hood due to Apple's restrictions on third-party browser engines.
|
|
68
|
+
// When you select the "iPad" device in Chrome Developer Tools, you're essentially emulating the behavior of Safari on an iPad, including the user agent string.
|
|
69
|
+
// Therefore, even though you're using Chrome, the user agent string will resemble that of Safari on an iPad.
|
|
70
|
+
// Since the regular expression /^((?!chrome|android).)*safari/i checks for the presence of "safari" in the user agent string while excluding "chrome" and "android",
|
|
71
|
+
// it will return true in this case because "safari" is present in the user agent string emulated by Chrome when in iPad mode.
|
|
72
|
+
|
|
73
|
+
var IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
74
|
+
|
|
75
|
+
function generateAdditionalKeys() {
|
|
76
|
+
var keyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
77
|
+
return keyData.map(function (key) {
|
|
78
|
+
return {
|
|
79
|
+
name: key,
|
|
80
|
+
latex: key,
|
|
81
|
+
write: key,
|
|
82
|
+
label: key
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getKeyPadWidth() {
|
|
88
|
+
var additionalKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
89
|
+
var equationEditor = arguments.length > 1 ? arguments[1] : undefined;
|
|
90
|
+
return Math.floor(additionalKeys.length / 5) * 30 + (equationEditor === 'miscellaneous' ? 600 : 500);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function prepareForStatic(model, state) {
|
|
94
|
+
var _ref = model || {},
|
|
95
|
+
config = _ref.config,
|
|
96
|
+
disabled = _ref.disabled;
|
|
97
|
+
|
|
98
|
+
var _ref2 = config || {},
|
|
99
|
+
expression = _ref2.expression,
|
|
100
|
+
responses = _ref2.responses,
|
|
101
|
+
printMode = _ref2.printMode,
|
|
102
|
+
alwaysShowCorrect = _ref2.alwaysShowCorrect;
|
|
103
|
+
|
|
104
|
+
if (config && expression) {
|
|
105
|
+
var modelExpression = expression;
|
|
106
|
+
|
|
107
|
+
if (state.showCorrect) {
|
|
108
|
+
return responses && responses.length && responses[0].answer;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var answerBlocks = 1; // assume one at least
|
|
112
|
+
// build out local state model using responses declared in expression
|
|
113
|
+
|
|
114
|
+
return (modelExpression || '').replace(REGEX, function () {
|
|
115
|
+
var answer = state.session.answers["r".concat(answerBlocks)];
|
|
116
|
+
|
|
117
|
+
if (printMode && !alwaysShowCorrect) {
|
|
118
|
+
var blankSpace = '\\ \\ '.repeat(30) + '\\newline ';
|
|
119
|
+
return "\\MathQuillMathField[r".concat(answerBlocks++, "]{").concat(blankSpace.repeat(3), "}");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (disabled) {
|
|
123
|
+
return "\\embed{answerBlock}[r".concat(answerBlocks++, "]");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return "\\MathQuillMathField[r".concat(answerBlocks++, "]{").concat(answer && answer.value || '', "}");
|
|
127
|
+
}).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
132
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
133
|
+
|
|
134
|
+
var _super = _createSuper(Main);
|
|
135
|
+
|
|
136
|
+
function Main(props) {
|
|
137
|
+
var _this;
|
|
138
|
+
|
|
139
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
140
|
+
_this = _super.call(this, props);
|
|
141
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleAnswerBlockDomUpdate", function () {
|
|
142
|
+
var _this$props = _this.props,
|
|
143
|
+
model = _this$props.model,
|
|
144
|
+
classes = _this$props.classes;
|
|
145
|
+
var _this$state = _this.state,
|
|
146
|
+
session = _this$state.session,
|
|
147
|
+
showCorrect = _this$state.showCorrect;
|
|
148
|
+
var answers = session.answers;
|
|
149
|
+
|
|
150
|
+
if (_this.root && model.disabled && !showCorrect) {
|
|
151
|
+
Object.keys(answers).forEach(function (answerId) {
|
|
152
|
+
var el = _this.root.querySelector("#".concat(answerId));
|
|
153
|
+
|
|
154
|
+
var indexEl = _this.root.querySelector("#".concat(answerId, "Index")); // const correct = model.correctness && model.correctness.correct;
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
if (el) {
|
|
158
|
+
var MQ = _mathquill["default"].getInterface(2);
|
|
159
|
+
|
|
160
|
+
var answer = answers[answerId];
|
|
161
|
+
el.textContent = answer && answer.value || '';
|
|
162
|
+
|
|
163
|
+
if (!model.view) {// for now, we're not going to be showing individual response correctness
|
|
164
|
+
// TODO re-attach the classes once we are
|
|
165
|
+
// el.parentElement.parentElement.classList.add(
|
|
166
|
+
// correct ? classes.correct : classes.incorrect
|
|
167
|
+
// );
|
|
168
|
+
} else {
|
|
169
|
+
el.parentElement.parentElement.classList.remove(classes.correct);
|
|
170
|
+
el.parentElement.parentElement.classList.remove(classes.incorrect);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
MQ.StaticMath(el); // For now, we're not going to be indexing response blocks
|
|
174
|
+
// TODO go back to indexing once we support individual response correctness
|
|
175
|
+
// indexEl.textContent = `R${idx + 1}`;
|
|
176
|
+
|
|
177
|
+
indexEl.textContent = 'R';
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
(0, _mathRenderingAccessible.renderMath)(_this.root);
|
|
183
|
+
});
|
|
184
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateAria", function () {
|
|
185
|
+
if (_this.root) {
|
|
186
|
+
// Update aria-hidden for .mq-selectable elements
|
|
187
|
+
var selectableElements = _this.root.querySelectorAll('.mq-selectable');
|
|
188
|
+
|
|
189
|
+
selectableElements.forEach(function (elem) {
|
|
190
|
+
return elem.setAttribute('aria-hidden', 'true');
|
|
191
|
+
}); // Update aria-label for textarea elements
|
|
192
|
+
|
|
193
|
+
var textareaElements = _this.root.querySelectorAll('textarea');
|
|
194
|
+
|
|
195
|
+
textareaElements.forEach(function (elem) {
|
|
196
|
+
elem.setAttribute('aria-label', 'Enter answer using math editor buttons or keyboard.');
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDone", function () {});
|
|
201
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSimpleResponseChange", function (response) {
|
|
202
|
+
_this.setState(function (state) {
|
|
203
|
+
return {
|
|
204
|
+
session: _objectSpread(_objectSpread({}, state.session), {}, {
|
|
205
|
+
response: response
|
|
206
|
+
})
|
|
207
|
+
};
|
|
208
|
+
}, _this.callOnSessionChange);
|
|
209
|
+
});
|
|
210
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSubFieldFocus", function (id) {
|
|
211
|
+
_this.setState({
|
|
212
|
+
activeAnswerBlock: id
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toNodeData", function (data) {
|
|
216
|
+
if (!data) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var type = data.type,
|
|
221
|
+
value = data.value;
|
|
222
|
+
|
|
223
|
+
if (type === 'command' || type === 'cursor') {
|
|
224
|
+
return data;
|
|
225
|
+
} else if (type === 'answer') {
|
|
226
|
+
return _objectSpread({
|
|
227
|
+
type: 'answer'
|
|
228
|
+
}, data);
|
|
229
|
+
} else if (value === 'clear') {
|
|
230
|
+
return {
|
|
231
|
+
type: 'clear'
|
|
232
|
+
};
|
|
233
|
+
} else {
|
|
234
|
+
return {
|
|
235
|
+
type: 'write',
|
|
236
|
+
value: value
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setInput", function (input) {
|
|
241
|
+
_this.input = input;
|
|
242
|
+
});
|
|
243
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClick", function (data) {
|
|
244
|
+
var c = _this.toNodeData(data);
|
|
245
|
+
|
|
246
|
+
if (c.type === 'clear') {
|
|
247
|
+
_this.input.clear();
|
|
248
|
+
} else if (c.type === 'command') {
|
|
249
|
+
if (Array.isArray(c.value)) {
|
|
250
|
+
c.value.forEach(function (vv) {
|
|
251
|
+
_this.input.cmd(vv);
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
_this.input.cmd(c.value);
|
|
255
|
+
}
|
|
256
|
+
} else if (c.type === 'cursor') {
|
|
257
|
+
_this.input.keystroke(c.value);
|
|
258
|
+
} else {
|
|
259
|
+
_this.input.write(c.value);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
_this.input.focus();
|
|
263
|
+
});
|
|
264
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "callOnSessionChange", function () {
|
|
265
|
+
var onSessionChange = _this.props.onSessionChange;
|
|
266
|
+
|
|
267
|
+
if (onSessionChange) {
|
|
268
|
+
onSessionChange(_this.state.session);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleShowCorrect", function (show) {
|
|
272
|
+
_this.setState({
|
|
273
|
+
showCorrect: show
|
|
274
|
+
}, _this.handleAnswerBlockDomUpdate);
|
|
275
|
+
});
|
|
276
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "subFieldChanged", function (name, subfieldValue) {
|
|
277
|
+
(0, _mathInput.updateSpans)();
|
|
278
|
+
|
|
279
|
+
if (name) {
|
|
280
|
+
_this.setState(function (state) {
|
|
281
|
+
return {
|
|
282
|
+
session: _objectSpread(_objectSpread({}, state.session), {}, {
|
|
283
|
+
completeAnswer: _this.mqStatic && _this.mqStatic.mathField.latex(),
|
|
284
|
+
answers: _objectSpread(_objectSpread({}, state.session.answers), {}, (0, _defineProperty2["default"])({}, name, {
|
|
285
|
+
value: subfieldValue
|
|
286
|
+
}))
|
|
287
|
+
})
|
|
288
|
+
};
|
|
289
|
+
}, _this.callOnSessionChange);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getFieldName", function (changeField, fields) {
|
|
293
|
+
var answers = _this.state.session.answers;
|
|
294
|
+
|
|
295
|
+
if (Object.keys(answers || {}).length) {
|
|
296
|
+
var keys = Object.keys(answers);
|
|
297
|
+
return keys.find(function (k) {
|
|
298
|
+
var tf = fields[k];
|
|
299
|
+
return tf && tf.id == changeField.id;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (e) {
|
|
304
|
+
var _ref3 = e || {},
|
|
305
|
+
relatedTarget = _ref3.relatedTarget,
|
|
306
|
+
currentTarget = _ref3.currentTarget;
|
|
307
|
+
|
|
308
|
+
function getParentWithRoleTooltip(element) {
|
|
309
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
310
|
+
// only run this max 16 times
|
|
311
|
+
if (!element || depth >= 16) return null;
|
|
312
|
+
var parent = element.offsetParent;
|
|
313
|
+
if (!parent) return null;
|
|
314
|
+
|
|
315
|
+
if (parent.getAttribute('role') === 'tooltip') {
|
|
316
|
+
return parent;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return getParentWithRoleTooltip(parent, depth + 1);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function getDeepChildDataKeypad(element) {
|
|
323
|
+
var _element$children;
|
|
324
|
+
|
|
325
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
326
|
+
// only run this max 4 times
|
|
327
|
+
if (!element || depth >= 4) return null;
|
|
328
|
+
var child = element === null || element === void 0 ? void 0 : (_element$children = element.children) === null || _element$children === void 0 ? void 0 : _element$children[0];
|
|
329
|
+
if (!child) return null;
|
|
330
|
+
|
|
331
|
+
if (child.attributes && child.attributes['data-keypad']) {
|
|
332
|
+
return child;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return getDeepChildDataKeypad(child, depth + 1);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var parentWithTooltipRole = getParentWithRoleTooltip(relatedTarget);
|
|
339
|
+
var childWithDataKeypad = parentWithTooltipRole ? getDeepChildDataKeypad(parentWithTooltipRole) : null;
|
|
340
|
+
|
|
341
|
+
if (!relatedTarget || !currentTarget || !(childWithDataKeypad !== null && childWithDataKeypad !== void 0 && childWithDataKeypad.attributes['data-keypad'])) {
|
|
342
|
+
_this.setState({
|
|
343
|
+
activeAnswerBlock: ''
|
|
344
|
+
});
|
|
345
|
+
} // else {
|
|
346
|
+
// // Just for debugging purpose:
|
|
347
|
+
// console.log('\n\nNew childWithDataKeypad', childWithDataKeypad);
|
|
348
|
+
//
|
|
349
|
+
// if (IS_SAFARI) {
|
|
350
|
+
// // (IS_SAFARI && !relatedTarget?.offsetParent?.children[0]?.children[0]?.attributes?.['data-keypad'])
|
|
351
|
+
// console.log('What was being used', relatedTarget?.offsetParent?.children[0]?.children[0]);
|
|
352
|
+
// } else {
|
|
353
|
+
// // (!IS_SAFARI && !relatedTarget?.offsetParent?.children[0]?.attributes?.['data-keypad']) ||
|
|
354
|
+
// console.log('What was being used', relatedTarget?.offsetParent?.children[0]);
|
|
355
|
+
// }
|
|
356
|
+
// }
|
|
357
|
+
|
|
358
|
+
});
|
|
359
|
+
var _answers = {};
|
|
360
|
+
|
|
361
|
+
if (props.model.config && props.model.config.expression) {
|
|
362
|
+
var answerBlocks = 1; // assume one at least
|
|
363
|
+
// build out local state model using responses declared in expression
|
|
364
|
+
|
|
365
|
+
(props.model.config.expression || '').replace(REGEX, function () {
|
|
366
|
+
_answers["r".concat(answerBlocks)] = {
|
|
367
|
+
value: props.session && props.session.answers && props.session.answers["r".concat(answerBlocks)] && props.session.answers["r".concat(answerBlocks)].value || ''
|
|
368
|
+
};
|
|
369
|
+
answerBlocks += 1;
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
_this.state = {
|
|
374
|
+
session: _objectSpread(_objectSpread({}, props.session), {}, {
|
|
375
|
+
answers: _answers
|
|
376
|
+
}),
|
|
377
|
+
activeAnswerBlock: '',
|
|
378
|
+
showCorrect: _this.props.model.config.alwaysShowCorrect || false
|
|
379
|
+
};
|
|
380
|
+
return _this;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
(0, _createClass2["default"])(Main, [{
|
|
384
|
+
key: "UNSAFE_componentWillMount",
|
|
385
|
+
value: function UNSAFE_componentWillMount() {
|
|
386
|
+
var classes = this.props.classes;
|
|
387
|
+
|
|
388
|
+
if (typeof window !== 'undefined') {
|
|
389
|
+
var MQ = _mathquill["default"].getInterface(2);
|
|
390
|
+
|
|
391
|
+
if (!registered) {
|
|
392
|
+
MQ.registerEmbed('answerBlock', function (data) {
|
|
393
|
+
return {
|
|
394
|
+
htmlString: "<div class=\"".concat(classes.blockContainer, "\">\n <div class=\"").concat(classes.blockResponse, "\" id=\"").concat(data, "Index\">R</div>\n <div class=\"").concat(classes.blockMath, "\">\n <span id=\"").concat(data, "\"></span>\n </div>\n </div>"),
|
|
395
|
+
text: function text() {
|
|
396
|
+
return 'text';
|
|
397
|
+
},
|
|
398
|
+
latex: function latex() {
|
|
399
|
+
return "\\embed{answerBlock}[".concat(data, "]");
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
registered = true;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}, {
|
|
408
|
+
key: "countResponseOccurrences",
|
|
409
|
+
value: function countResponseOccurrences(expression) {
|
|
410
|
+
var pattern = /\{\{response\}\}/g;
|
|
411
|
+
var matches = expression.match(pattern);
|
|
412
|
+
return matches ? matches.length : 0;
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
416
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
417
|
+
var _this2 = this;
|
|
418
|
+
|
|
419
|
+
var config = this.props.model.config;
|
|
420
|
+
|
|
421
|
+
var _ref4 = nextProps.model || {},
|
|
422
|
+
_ref4$config = _ref4.config,
|
|
423
|
+
nextConfig = _ref4$config === void 0 ? {} : _ref4$config; // check if the note is the default one for prev language and change to the default one for new language
|
|
424
|
+
// this check is necessary in order to diferanciate between default and authour defined note
|
|
425
|
+
// and only change between languages for default ones
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
if (config.note && config.language && config.language !== nextConfig.language && config.note === translator.t('mathInline.primaryCorrectWithAlternates', {
|
|
429
|
+
lng: config.language
|
|
430
|
+
})) {
|
|
431
|
+
config.note = translator.t('mathInline.primaryCorrectWithAlternates', {
|
|
432
|
+
lng: nextConfig.language
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (config.env && config.env.mode !== 'evaluate' || nextConfig.env && nextConfig.env.mode !== 'evaluate') {
|
|
437
|
+
this.setState(_objectSpread(_objectSpread({}, this.state.session), {}, {
|
|
438
|
+
showCorrect: false
|
|
439
|
+
}));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (nextConfig.alwaysShowCorrect) {
|
|
443
|
+
this.setState({
|
|
444
|
+
showCorrect: true
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (this.countResponseOccurrences(config.expression) < this.countResponseOccurrences(nextConfig.expression)) {
|
|
449
|
+
setTimeout(function () {
|
|
450
|
+
return _this2.updateAria();
|
|
451
|
+
}, 100);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (config && config.responses && config.responses.length !== nextConfig.responses.length || !config && nextConfig && nextConfig.responses || config && nextConfig && config.expression !== nextConfig.expression) {
|
|
455
|
+
var newAnswers = {};
|
|
456
|
+
var answers = this.state.session.answers;
|
|
457
|
+
var answerBlocks = 1; // assume one at least
|
|
458
|
+
// build out local state model using responses declared in expression
|
|
459
|
+
|
|
460
|
+
(nextConfig.expression || '').replace(REGEX, function () {
|
|
461
|
+
newAnswers["r".concat(answerBlocks)] = {
|
|
462
|
+
value: answers && answers["r".concat(answerBlocks)] && answers["r".concat(answerBlocks)].value || ''
|
|
463
|
+
};
|
|
464
|
+
answerBlocks++;
|
|
465
|
+
});
|
|
466
|
+
this.setState(function (state) {
|
|
467
|
+
return {
|
|
468
|
+
session: _objectSpread(_objectSpread({}, state.session), {}, {
|
|
469
|
+
completeAnswer: _this2.mqStatic && _this2.mqStatic.mathField.latex(),
|
|
470
|
+
answers: newAnswers
|
|
471
|
+
})
|
|
472
|
+
};
|
|
473
|
+
}, this.handleAnswerBlockDomUpdate);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}, {
|
|
477
|
+
key: "shouldComponentUpdate",
|
|
478
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
479
|
+
var sameModel = (0, _isEqual["default"])(this.props.model, nextProps.model);
|
|
480
|
+
var sameState = (0, _isEqual["default"])(this.state, nextState);
|
|
481
|
+
return !sameModel || !sameState;
|
|
482
|
+
}
|
|
483
|
+
}, {
|
|
484
|
+
key: "componentDidMount",
|
|
485
|
+
value: function componentDidMount() {
|
|
486
|
+
var _this3 = this;
|
|
487
|
+
|
|
488
|
+
this.handleAnswerBlockDomUpdate();
|
|
489
|
+
this.updateAria();
|
|
490
|
+
setTimeout(function () {
|
|
491
|
+
return (0, _mathRenderingAccessible.renderMath)(_this3.root);
|
|
492
|
+
}, 100);
|
|
493
|
+
}
|
|
494
|
+
}, {
|
|
495
|
+
key: "componentDidUpdate",
|
|
496
|
+
value: function componentDidUpdate() {
|
|
497
|
+
this.handleAnswerBlockDomUpdate();
|
|
498
|
+
}
|
|
499
|
+
}, {
|
|
500
|
+
key: "setTooltipRef",
|
|
501
|
+
value: function setTooltipRef(ref) {
|
|
502
|
+
// Safari Hack: https://stackoverflow.com/a/42764495/5757635
|
|
503
|
+
setTimeout(function () {
|
|
504
|
+
if (ref && IS_SAFARI) {
|
|
505
|
+
var div = document.querySelector("[role='tooltip']");
|
|
506
|
+
|
|
507
|
+
if (div) {
|
|
508
|
+
var el = div.firstChild;
|
|
509
|
+
el.setAttribute('tabindex', '-1');
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}, 1);
|
|
513
|
+
}
|
|
514
|
+
}, {
|
|
515
|
+
key: "render",
|
|
516
|
+
value: function render() {
|
|
517
|
+
var _this4 = this,
|
|
518
|
+
_cx;
|
|
519
|
+
|
|
520
|
+
var _this$props2 = this.props,
|
|
521
|
+
model = _this$props2.model,
|
|
522
|
+
classes = _this$props2.classes;
|
|
523
|
+
var _this$state2 = this.state,
|
|
524
|
+
activeAnswerBlock = _this$state2.activeAnswerBlock,
|
|
525
|
+
showCorrect = _this$state2.showCorrect,
|
|
526
|
+
session = _this$state2.session;
|
|
527
|
+
|
|
528
|
+
var _ref5 = model || {},
|
|
529
|
+
config = _ref5.config,
|
|
530
|
+
correctness = _ref5.correctness,
|
|
531
|
+
disabled = _ref5.disabled,
|
|
532
|
+
view = _ref5.view,
|
|
533
|
+
teacherInstructions = _ref5.teacherInstructions,
|
|
534
|
+
rationale = _ref5.rationale,
|
|
535
|
+
feedback = _ref5.feedback,
|
|
536
|
+
animationsDisabled = _ref5.animationsDisabled,
|
|
537
|
+
printMode = _ref5.printMode,
|
|
538
|
+
alwaysShowCorrect = _ref5.alwaysShowCorrect,
|
|
539
|
+
language = _ref5.language;
|
|
540
|
+
|
|
541
|
+
if (!config) {
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
var _ref6 = config || {},
|
|
546
|
+
showNote = _ref6.showNote,
|
|
547
|
+
note = _ref6.note,
|
|
548
|
+
prompt = _ref6.prompt,
|
|
549
|
+
responses = _ref6.responses,
|
|
550
|
+
responseType = _ref6.responseType,
|
|
551
|
+
equationEditor = _ref6.equationEditor,
|
|
552
|
+
customKeys = _ref6.customKeys,
|
|
553
|
+
_ref6$env = _ref6.env;
|
|
554
|
+
|
|
555
|
+
_ref6$env = _ref6$env === void 0 ? {} : _ref6$env;
|
|
556
|
+
var mode = _ref6$env.mode,
|
|
557
|
+
role = _ref6$env.role;
|
|
558
|
+
var displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note;
|
|
559
|
+
var emptyResponse = (0, _isEmpty["default"])(responses);
|
|
560
|
+
var showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';
|
|
561
|
+
var tooltipModeEnabled = disabled && correctness;
|
|
562
|
+
var additionalKeys = generateAdditionalKeys(customKeys);
|
|
563
|
+
var correct = correctness && correctness.correct;
|
|
564
|
+
var staticLatex = prepareForStatic(model, this.state) || '';
|
|
565
|
+
var viewMode = disabled && !correctness;
|
|
566
|
+
var studentPrintMode = printMode && !alwaysShowCorrect;
|
|
567
|
+
|
|
568
|
+
var printView = /*#__PURE__*/_react["default"].createElement("div", {
|
|
569
|
+
className: classes.printContainer
|
|
570
|
+
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
571
|
+
className: classes["static"],
|
|
572
|
+
ref: function ref(mqStatic) {
|
|
573
|
+
return _this4.mqStatic = mqStatic || _this4.mqStatic;
|
|
574
|
+
},
|
|
575
|
+
latex: staticLatex,
|
|
576
|
+
onSubFieldChange: this.subFieldChanged,
|
|
577
|
+
getFieldName: this.getFieldName,
|
|
578
|
+
setInput: this.setInput,
|
|
579
|
+
onSubFieldFocus: this.onSubFieldFocus,
|
|
580
|
+
onBlur: this.onBlur
|
|
581
|
+
}));
|
|
582
|
+
|
|
583
|
+
var midContent = /*#__PURE__*/_react["default"].createElement("div", {
|
|
584
|
+
className: classes.main
|
|
585
|
+
}, mode === 'gather' && /*#__PURE__*/_react["default"].createElement("h2", {
|
|
586
|
+
className: classes.srOnly
|
|
587
|
+
}, "Math Equation Response Question"), viewMode && teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && (!animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
588
|
+
className: classes.collapsible,
|
|
589
|
+
labels: {
|
|
590
|
+
hidden: 'Show Teacher Instructions',
|
|
591
|
+
visible: 'Hide Teacher Instructions'
|
|
592
|
+
}
|
|
593
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
594
|
+
dangerouslySetInnerHTML: {
|
|
595
|
+
__html: teacherInstructions
|
|
596
|
+
}
|
|
597
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
598
|
+
dangerouslySetInnerHTML: {
|
|
599
|
+
__html: teacherInstructions
|
|
600
|
+
}
|
|
601
|
+
})), prompt && /*#__PURE__*/_react["default"].createElement("div", {
|
|
602
|
+
className: classes.promptContainer
|
|
603
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
604
|
+
prompt: prompt
|
|
605
|
+
})), studentPrintMode ? printView : /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
606
|
+
"false": true
|
|
607
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
608
|
+
className: classes.inputAndKeypadContainer
|
|
609
|
+
}, responseType === _utils.ResponseTypes.simple && /*#__PURE__*/_react["default"].createElement(_simpleQuestionBlock["default"], {
|
|
610
|
+
onSimpleResponseChange: this.onSimpleResponseChange,
|
|
611
|
+
showCorrect: showCorrect,
|
|
612
|
+
emptyResponse: emptyResponse,
|
|
613
|
+
model: model,
|
|
614
|
+
session: session
|
|
615
|
+
}), responseType === _utils.ResponseTypes.advanced && /*#__PURE__*/_react["default"].createElement("div", {
|
|
616
|
+
className: (0, _classnames["default"])(classes.expression, (_cx = {}, (0, _defineProperty2["default"])(_cx, classes.incorrect, !emptyResponse && !correct && !showCorrect), (0, _defineProperty2["default"])(_cx, classes.correct, !emptyResponse && (correct || showCorrect)), (0, _defineProperty2["default"])(_cx, classes.showCorrectness, !emptyResponse && disabled && correctness && !view), (0, _defineProperty2["default"])(_cx, classes.correctAnswerShown, showCorrect), (0, _defineProperty2["default"])(_cx, classes.printCorrect, printMode && alwaysShowCorrect), _cx))
|
|
617
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
618
|
+
ref: function ref(_ref7) {
|
|
619
|
+
return _this4.setTooltipRef(_ref7);
|
|
620
|
+
},
|
|
621
|
+
interactive: true,
|
|
622
|
+
open: !!activeAnswerBlock,
|
|
623
|
+
classes: {
|
|
624
|
+
tooltip: classes.keypadTooltip,
|
|
625
|
+
popper: classes.keypadTooltipPopper
|
|
626
|
+
},
|
|
627
|
+
title: Object.keys(session.answers).map(function (answerId) {
|
|
628
|
+
return answerId === activeAnswerBlock && !(showCorrect || disabled) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
629
|
+
"data-keypad": true,
|
|
630
|
+
key: answerId,
|
|
631
|
+
className: classes.responseContainer,
|
|
632
|
+
style: {
|
|
633
|
+
// marginTop: this.mqStatic && this.mqStatic.input.offsetHeight - 20,
|
|
634
|
+
width: getKeyPadWidth(additionalKeys, equationEditor)
|
|
635
|
+
}
|
|
636
|
+
}, /*#__PURE__*/_react["default"].createElement(_mathInput.HorizontalKeypad, {
|
|
637
|
+
additionalKeys: additionalKeys,
|
|
638
|
+
mode: equationEditor || DEFAULT_KEYPAD_VARIANT,
|
|
639
|
+
onClick: _this4.onClick
|
|
640
|
+
})) || null;
|
|
641
|
+
})
|
|
642
|
+
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
643
|
+
className: classes["static"],
|
|
644
|
+
ref: function ref(mqStatic) {
|
|
645
|
+
return _this4.mqStatic = mqStatic || _this4.mqStatic;
|
|
646
|
+
},
|
|
647
|
+
latex: staticLatex,
|
|
648
|
+
onSubFieldChange: this.subFieldChanged,
|
|
649
|
+
getFieldName: this.getFieldName,
|
|
650
|
+
setInput: this.setInput,
|
|
651
|
+
onSubFieldFocus: this.onSubFieldFocus,
|
|
652
|
+
onBlur: this.onBlur
|
|
653
|
+
}))))), viewMode && displayNote && /*#__PURE__*/_react["default"].createElement("div", {
|
|
654
|
+
className: classes.note,
|
|
655
|
+
dangerouslySetInnerHTML: {
|
|
656
|
+
__html: "<strong>Note:</strong> ".concat(note)
|
|
657
|
+
}
|
|
658
|
+
}), viewMode && rationale && (0, _renderUi.hasText)(rationale) && (!animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
659
|
+
labels: {
|
|
660
|
+
hidden: 'Show Rationale',
|
|
661
|
+
visible: 'Hide Rationale'
|
|
662
|
+
}
|
|
663
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
664
|
+
dangerouslySetInnerHTML: {
|
|
665
|
+
__html: rationale
|
|
666
|
+
}
|
|
667
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
668
|
+
dangerouslySetInnerHTML: {
|
|
669
|
+
__html: rationale
|
|
670
|
+
}
|
|
671
|
+
})));
|
|
672
|
+
|
|
673
|
+
if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) || rationale && (0, _renderUi.hasText)(rationale) || feedback)) {
|
|
674
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
675
|
+
interactive: true,
|
|
676
|
+
classes: {
|
|
677
|
+
tooltip: classes.tooltip,
|
|
678
|
+
popper: classes.tooltipPopper
|
|
679
|
+
},
|
|
680
|
+
title: /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
681
|
+
className: classes.main
|
|
682
|
+
}, showCorrectAnswerToggle && /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle.CorrectAnswerToggle, {
|
|
683
|
+
language: language,
|
|
684
|
+
className: classes.toggle,
|
|
685
|
+
show: true,
|
|
686
|
+
toggled: showCorrect,
|
|
687
|
+
onToggle: this.toggleShowCorrect
|
|
688
|
+
})), teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
689
|
+
className: classes.collapsible,
|
|
690
|
+
key: "collapsible-teacher-instructions",
|
|
691
|
+
labels: {
|
|
692
|
+
hidden: 'Show Teacher Instructions',
|
|
693
|
+
visible: 'Hide Teacher Instructions'
|
|
694
|
+
}
|
|
695
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
696
|
+
prompt: teacherInstructions
|
|
697
|
+
})), displayNote && (0, _renderUi.hasText)(note) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
698
|
+
className: classes.collapsible,
|
|
699
|
+
key: "collapsible-note",
|
|
700
|
+
labels: {
|
|
701
|
+
hidden: translator.t('common:showNote', {
|
|
702
|
+
lng: language
|
|
703
|
+
}),
|
|
704
|
+
visible: translator.t('common:hideNote', {
|
|
705
|
+
lng: language
|
|
706
|
+
})
|
|
707
|
+
}
|
|
708
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
709
|
+
prompt: note
|
|
710
|
+
})), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
711
|
+
className: classes.collapsible,
|
|
712
|
+
key: "collapsible-rationale",
|
|
713
|
+
labels: {
|
|
714
|
+
hidden: 'Show Rationale',
|
|
715
|
+
visible: 'Hide Rationale'
|
|
716
|
+
}
|
|
717
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
718
|
+
prompt: rationale
|
|
719
|
+
})), feedback && /*#__PURE__*/_react["default"].createElement(_renderUi.Feedback, {
|
|
720
|
+
correctness: correctness.correctness,
|
|
721
|
+
feedback: feedback
|
|
722
|
+
}))
|
|
723
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
724
|
+
className: classes.mainContainer,
|
|
725
|
+
ref: function ref(r) {
|
|
726
|
+
return _this4.root = r || _this4.root;
|
|
727
|
+
}
|
|
728
|
+
}, midContent));
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
732
|
+
className: classes.mainContainer,
|
|
733
|
+
ref: function ref(r) {
|
|
734
|
+
return _this4.root = r || _this4.root;
|
|
735
|
+
}
|
|
736
|
+
}, midContent);
|
|
737
|
+
}
|
|
738
|
+
}]);
|
|
739
|
+
return Main;
|
|
740
|
+
}(_react["default"].Component);
|
|
741
|
+
|
|
742
|
+
exports.Main = Main;
|
|
743
|
+
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
744
|
+
classes: _propTypes["default"].object,
|
|
745
|
+
session: _propTypes["default"].object.isRequired,
|
|
746
|
+
onSessionChange: _propTypes["default"].func,
|
|
747
|
+
model: _propTypes["default"].object.isRequired
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
var styles = function styles(theme) {
|
|
751
|
+
return {
|
|
752
|
+
mainContainer: {
|
|
753
|
+
color: _renderUi.color.text(),
|
|
754
|
+
backgroundColor: _renderUi.color.background(),
|
|
755
|
+
display: 'inline-block'
|
|
756
|
+
},
|
|
757
|
+
tooltip: {
|
|
758
|
+
background: "".concat(_renderUi.color.primaryLight(), " !important"),
|
|
759
|
+
color: _renderUi.color.text(),
|
|
760
|
+
padding: theme.spacing.unit * 2,
|
|
761
|
+
border: "1px solid ".concat(_renderUi.color.secondary()),
|
|
762
|
+
fontSize: '16px',
|
|
763
|
+
'& :not(.MathJax) > table tr': {
|
|
764
|
+
'&:nth-child(2n)': {
|
|
765
|
+
backgroundColor: 'unset !important'
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
tooltipPopper: {
|
|
770
|
+
opacity: 1
|
|
771
|
+
},
|
|
772
|
+
keypadTooltip: {
|
|
773
|
+
fontSize: 'initial',
|
|
774
|
+
background: 'transparent',
|
|
775
|
+
width: '600px',
|
|
776
|
+
marginTop: 0,
|
|
777
|
+
paddingTop: 0
|
|
778
|
+
},
|
|
779
|
+
keypadTooltipPopper: {
|
|
780
|
+
background: 'transparent',
|
|
781
|
+
width: '650px',
|
|
782
|
+
opacity: 1
|
|
783
|
+
},
|
|
784
|
+
promptContainer: {
|
|
785
|
+
marginBottom: theme.spacing.unit * 2
|
|
786
|
+
},
|
|
787
|
+
main: {
|
|
788
|
+
width: '100%',
|
|
789
|
+
position: 'relative',
|
|
790
|
+
backgroundColor: _renderUi.color.background(),
|
|
791
|
+
color: _renderUi.color.text()
|
|
792
|
+
},
|
|
793
|
+
title: {
|
|
794
|
+
fontSize: '1.1rem',
|
|
795
|
+
display: 'block',
|
|
796
|
+
marginTop: theme.spacing.unit * 2,
|
|
797
|
+
marginBottom: theme.spacing.unit
|
|
798
|
+
},
|
|
799
|
+
note: {
|
|
800
|
+
paddingBottom: theme.spacing.unit * 2
|
|
801
|
+
},
|
|
802
|
+
collapsible: {
|
|
803
|
+
marginBottom: theme.spacing.unit * 2
|
|
804
|
+
},
|
|
805
|
+
responseContainer: {
|
|
806
|
+
zIndex: 10,
|
|
807
|
+
// position: 'absolute',
|
|
808
|
+
// right: 0,
|
|
809
|
+
minWidth: '400px',
|
|
810
|
+
marginTop: theme.spacing.unit * 2
|
|
811
|
+
},
|
|
812
|
+
expression: {
|
|
813
|
+
maxWidth: 'fit-content',
|
|
814
|
+
'& > .mq-math-mode': {
|
|
815
|
+
'& > .mq-root-block': {
|
|
816
|
+
'& > .mq-editable-field': {
|
|
817
|
+
minWidth: '10px',
|
|
818
|
+
margin: theme.spacing.unit * 2 / 3,
|
|
819
|
+
padding: theme.spacing.unit / 4
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
'& sup': {
|
|
823
|
+
top: 0
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
"static": {
|
|
828
|
+
'& > .mq-root-block': {
|
|
829
|
+
'& > .mq-editable-field': {
|
|
830
|
+
borderColor: _renderUi.color.text()
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
inputAndKeypadContainer: {
|
|
835
|
+
position: 'relative',
|
|
836
|
+
'& .mq-overarrow-inner': {
|
|
837
|
+
border: 'none !important',
|
|
838
|
+
padding: '0 !important'
|
|
839
|
+
},
|
|
840
|
+
'& .mq-overarrow-inner-right': {
|
|
841
|
+
display: 'none !important'
|
|
842
|
+
},
|
|
843
|
+
'& .mq-overarrow-inner-left': {
|
|
844
|
+
display: 'none !important'
|
|
845
|
+
},
|
|
846
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
847
|
+
minWidth: '1.23em',
|
|
848
|
+
'& *': {
|
|
849
|
+
lineHeight: '1 !important'
|
|
850
|
+
},
|
|
851
|
+
'&:before': {
|
|
852
|
+
top: '-0.4em',
|
|
853
|
+
left: '-1px'
|
|
854
|
+
},
|
|
855
|
+
'&:after': {
|
|
856
|
+
top: '-2.4em',
|
|
857
|
+
right: '-1px'
|
|
858
|
+
},
|
|
859
|
+
'&.mq-empty:after': {
|
|
860
|
+
top: '-0.45em'
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
864
|
+
'&:before': {
|
|
865
|
+
top: '-0.4em',
|
|
866
|
+
right: '-1px'
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
'& .mq-longdiv-inner': {
|
|
870
|
+
borderTop: '1px solid !important',
|
|
871
|
+
paddingTop: '1.5px !important'
|
|
872
|
+
},
|
|
873
|
+
'& .mq-parallelogram': {
|
|
874
|
+
lineHeight: 0.85
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
showCorrectness: {
|
|
878
|
+
border: '2px solid'
|
|
879
|
+
},
|
|
880
|
+
correctAnswerShown: {
|
|
881
|
+
padding: theme.spacing.unit,
|
|
882
|
+
letterSpacing: '0.5px'
|
|
883
|
+
},
|
|
884
|
+
printCorrect: {
|
|
885
|
+
border: "2px solid ".concat(_renderUi.color.correct(), " !important")
|
|
886
|
+
},
|
|
887
|
+
correct: {
|
|
888
|
+
borderColor: "".concat(_renderUi.color.correct(), " !important")
|
|
889
|
+
},
|
|
890
|
+
incorrect: {
|
|
891
|
+
borderColor: "".concat(_renderUi.color.incorrect(), " !important")
|
|
892
|
+
},
|
|
893
|
+
blockContainer: {
|
|
894
|
+
margin: "".concat(theme.spacing.unit, "px !important"),
|
|
895
|
+
display: 'inline-flex',
|
|
896
|
+
border: '2px solid grey !important'
|
|
897
|
+
},
|
|
898
|
+
blockResponse: {
|
|
899
|
+
flex: 2,
|
|
900
|
+
color: 'grey',
|
|
901
|
+
background: theme.palette.grey['A100'],
|
|
902
|
+
fontSize: '0.8rem !important',
|
|
903
|
+
padding: "".concat(theme.spacing.unit / 2, "px !important"),
|
|
904
|
+
display: 'flex',
|
|
905
|
+
alignItems: 'center',
|
|
906
|
+
justifyContent: 'center',
|
|
907
|
+
borderRight: "2px solid ".concat(_renderUi.color.disabled(), " !important")
|
|
908
|
+
},
|
|
909
|
+
toggle: {
|
|
910
|
+
color: _renderUi.color.text(),
|
|
911
|
+
marginBottom: theme.spacing.unit * 2
|
|
912
|
+
},
|
|
913
|
+
blockMath: {
|
|
914
|
+
color: _renderUi.color.text(),
|
|
915
|
+
backgroundColor: _renderUi.color.background(),
|
|
916
|
+
padding: "".concat(theme.spacing.unit / 2, "px !important"),
|
|
917
|
+
display: 'flex',
|
|
918
|
+
alignItems: 'center',
|
|
919
|
+
justifyContent: 'center',
|
|
920
|
+
flex: 8,
|
|
921
|
+
'& > .mq-math-mode': {
|
|
922
|
+
'& > .mq-hasCursor': {
|
|
923
|
+
'& > .mq-cursor': {
|
|
924
|
+
display: 'none'
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
printContainer: {
|
|
930
|
+
marginBottom: theme.spacing.unit,
|
|
931
|
+
pointerEvents: 'none'
|
|
932
|
+
},
|
|
933
|
+
srOnly: {
|
|
934
|
+
position: 'absolute',
|
|
935
|
+
left: '-10000px',
|
|
936
|
+
top: 'auto',
|
|
937
|
+
width: '1px',
|
|
938
|
+
height: '1px',
|
|
939
|
+
overflow: 'hidden'
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
var _default = (0, _styles.withStyles)(styles)(Main);
|
|
945
|
+
|
|
946
|
+
exports["default"] = _default;
|
|
947
|
+
//# sourceMappingURL=main.js.map
|