@pie-lib/math-toolbar 1.11.31-next.135 → 1.12.0-beta.2
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 +55 -196
- package/NEXT.CHANGELOG.json +1 -0
- package/package.json +7 -5
- package/src/__tests__/__snapshots__/editor-and-pad.test.js.snap +31 -0
- package/src/__tests__/__snapshots__/index.test.js.snap +30 -0
- package/src/__tests__/__snapshots__/math-preview.test.js.snap +23 -0
- package/src/__tests__/editor-and-pad.test.js +25 -0
- package/src/__tests__/index.test.js +28 -0
- package/src/__tests__/math-preview.test.js +31 -0
- package/src/editor-and-pad.jsx +21 -120
- package/src/index.jsx +12 -1
- package/src/math-preview.jsx +28 -48
- package/src/utils.js +11 -0
- package/lib/done-button.js +0 -68
- package/lib/done-button.js.map +0 -1
- package/lib/editor-and-pad.js +0 -653
- package/lib/editor-and-pad.js.map +0 -1
- package/lib/index.js +0 -275
- package/lib/index.js.map +0 -1
- package/lib/math-preview.js +0 -250
- package/lib/math-preview.js.map +0 -1
package/lib/editor-and-pad.js
DELETED
|
@@ -1,653 +0,0 @@
|
|
|
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.EditorAndPad = 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 _mathInput = require("@pie-lib/math-input");
|
|
25
|
-
|
|
26
|
-
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
|
-
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
35
|
-
|
|
36
|
-
var _styles = require("@material-ui/core/styles");
|
|
37
|
-
|
|
38
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
39
|
-
|
|
40
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
41
|
-
|
|
42
|
-
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
43
|
-
|
|
44
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
45
|
-
|
|
46
|
-
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); }; }
|
|
47
|
-
|
|
48
|
-
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; } }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
var log = (0, _debug["default"])('@pie-lib:math-toolbar:editor-and-pad');
|
|
55
|
-
var decimalRegex = /\.|,/g;
|
|
56
|
-
|
|
57
|
-
var toNodeData = function toNodeData(data) {
|
|
58
|
-
if (!data) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var type = data.type,
|
|
63
|
-
value = data.value;
|
|
64
|
-
|
|
65
|
-
if (type === 'command' || type === 'cursor') {
|
|
66
|
-
return data;
|
|
67
|
-
} else if (type === 'answer') {
|
|
68
|
-
return _objectSpread({
|
|
69
|
-
type: 'answer'
|
|
70
|
-
}, data);
|
|
71
|
-
} else if (value === 'clear') {
|
|
72
|
-
return {
|
|
73
|
-
type: 'clear'
|
|
74
|
-
};
|
|
75
|
-
} else {
|
|
76
|
-
return {
|
|
77
|
-
type: 'write',
|
|
78
|
-
value: value
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
var EditorAndPad = /*#__PURE__*/function (_React$Component) {
|
|
84
|
-
(0, _inherits2["default"])(EditorAndPad, _React$Component);
|
|
85
|
-
|
|
86
|
-
var _super = _createSuper(EditorAndPad);
|
|
87
|
-
|
|
88
|
-
function EditorAndPad(props) {
|
|
89
|
-
var _this;
|
|
90
|
-
|
|
91
|
-
(0, _classCallCheck2["default"])(this, EditorAndPad);
|
|
92
|
-
_this = _super.call(this, props);
|
|
93
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClick", function (data) {
|
|
94
|
-
var _this$props = _this.props,
|
|
95
|
-
noDecimal = _this$props.noDecimal,
|
|
96
|
-
noLatexHandling = _this$props.noLatexHandling,
|
|
97
|
-
onChange = _this$props.onChange;
|
|
98
|
-
var c = toNodeData(data);
|
|
99
|
-
log('mathChange: ', c);
|
|
100
|
-
|
|
101
|
-
if (noLatexHandling) {
|
|
102
|
-
onChange(c.value);
|
|
103
|
-
return;
|
|
104
|
-
} // if decimals are not allowed for this response, we discard the input
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (noDecimal && (c.value === '.' || c.value === ',')) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!c) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (c.type === 'clear') {
|
|
116
|
-
log('call clear...');
|
|
117
|
-
|
|
118
|
-
_this.input.clear();
|
|
119
|
-
} else if (c.type === 'command') {
|
|
120
|
-
_this.input.command(c.value);
|
|
121
|
-
} else if (c.type === 'cursor') {
|
|
122
|
-
_this.input.keystroke(c.value);
|
|
123
|
-
} else if (c.type === 'answer') {
|
|
124
|
-
_this.input.write('%response%');
|
|
125
|
-
} else {
|
|
126
|
-
_this.input.write(c.value);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateDisable", function (isEdit) {
|
|
130
|
-
var maxResponseAreas = _this.props.maxResponseAreas;
|
|
131
|
-
|
|
132
|
-
if (maxResponseAreas) {
|
|
133
|
-
var shouldDisable = _this.checkResponseAreasNumber(maxResponseAreas, isEdit);
|
|
134
|
-
|
|
135
|
-
_this.setState({
|
|
136
|
-
addDisabled: shouldDisable
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAnswerBlockClick", function () {
|
|
141
|
-
_this.props.onAnswerBlockAdd();
|
|
142
|
-
|
|
143
|
-
_this.onClick({
|
|
144
|
-
type: 'answer'
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
_this.updateDisable(true);
|
|
148
|
-
});
|
|
149
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onEditorChange", function (latex) {
|
|
150
|
-
var _this$props2 = _this.props,
|
|
151
|
-
onChange = _this$props2.onChange,
|
|
152
|
-
noDecimal = _this$props2.noDecimal;
|
|
153
|
-
(0, _mathInput.updateSpans)();
|
|
154
|
-
|
|
155
|
-
_this.updateDisable(true); // if no decimals are allowed and the last change is a decimal dot, discard the change
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && _this.input) {
|
|
159
|
-
_this.input.clear();
|
|
160
|
-
|
|
161
|
-
_this.input.write(latex.replace(decimalRegex, ''));
|
|
162
|
-
|
|
163
|
-
return;
|
|
164
|
-
} // eslint-disable-next-line no-useless-escape
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var regexMatch = latex.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
168
|
-
|
|
169
|
-
if (_this.input && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
170
|
-
try {
|
|
171
|
-
_this.input.mathField.__controller.cursor.insLeftOf(_this.input.mathField.__controller.cursor.parent[-1].parent);
|
|
172
|
-
|
|
173
|
-
_this.input.mathField.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
174
|
-
keyCode: 8
|
|
175
|
-
}));
|
|
176
|
-
} catch (e) {
|
|
177
|
-
// eslint-disable-next-line no-console
|
|
178
|
-
console.error(e.toString());
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
onChange(latex);
|
|
185
|
-
});
|
|
186
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onEditorTypeChange", function (evt) {
|
|
187
|
-
_this.setState({
|
|
188
|
-
equationEditor: evt.target.value
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "checkResponseAreasNumber", function (maxResponseAreas, isEdit) {
|
|
192
|
-
var _ref = _this.input && _this.input.props || {},
|
|
193
|
-
latex = _ref.latex;
|
|
194
|
-
|
|
195
|
-
if (latex) {
|
|
196
|
-
var count = (latex.match(/answerBlock/g) || []).length;
|
|
197
|
-
return isEdit ? count === maxResponseAreas - 1 : count === maxResponseAreas;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return false;
|
|
201
|
-
});
|
|
202
|
-
_this.state = {
|
|
203
|
-
equationEditor: 'item-authoring',
|
|
204
|
-
addDisabled: false
|
|
205
|
-
};
|
|
206
|
-
return _this;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
(0, _createClass2["default"])(EditorAndPad, [{
|
|
210
|
-
key: "componentDidMount",
|
|
211
|
-
value: function componentDidMount() {
|
|
212
|
-
if (this.input && this.props.autoFocus) {
|
|
213
|
-
this.input.focus();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}, {
|
|
217
|
-
key: "shouldComponentUpdate",
|
|
218
|
-
value:
|
|
219
|
-
/** Only render if the mathquill instance's latex is different
|
|
220
|
-
* or the keypad state changed from one state to the other (shown / hidden) */
|
|
221
|
-
function shouldComponentUpdate(nextProps, nextState) {
|
|
222
|
-
var inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
|
|
223
|
-
log('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
|
|
224
|
-
|
|
225
|
-
if (!(0, _isEqual["default"])(this.props.error, nextProps.error)) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (!inputIsDifferent && this.props.controlledKeypad) {
|
|
242
|
-
return this.props.showKeypad !== nextProps.showKeypad;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return inputIsDifferent;
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "render",
|
|
249
|
-
value: function render() {
|
|
250
|
-
var _this2 = this;
|
|
251
|
-
|
|
252
|
-
var _this$props3 = this.props,
|
|
253
|
-
classNames = _this$props3.classNames,
|
|
254
|
-
keypadMode = _this$props3.keypadMode,
|
|
255
|
-
allowAnswerBlock = _this$props3.allowAnswerBlock,
|
|
256
|
-
additionalKeys = _this$props3.additionalKeys,
|
|
257
|
-
controlledKeypad = _this$props3.controlledKeypad,
|
|
258
|
-
controlledKeypadMode = _this$props3.controlledKeypadMode,
|
|
259
|
-
showKeypad = _this$props3.showKeypad,
|
|
260
|
-
noDecimal = _this$props3.noDecimal,
|
|
261
|
-
hideInput = _this$props3.hideInput,
|
|
262
|
-
layoutForKeyPad = _this$props3.layoutForKeyPad,
|
|
263
|
-
latex = _this$props3.latex,
|
|
264
|
-
_onFocus = _this$props3.onFocus,
|
|
265
|
-
_onBlur = _this$props3.onBlur,
|
|
266
|
-
classes = _this$props3.classes,
|
|
267
|
-
error = _this$props3.error;
|
|
268
|
-
var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
|
|
269
|
-
var addDisabled = this.state.addDisabled;
|
|
270
|
-
log('[render]', latex);
|
|
271
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
272
|
-
className: (0, _classnames["default"])(classes.mathToolbar, classNames.mathToolbar)
|
|
273
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
274
|
-
className: (0, _classnames["default"])(classes.inputAndTypeContainer, (0, _defineProperty2["default"])({}, classes.hide, hideInput))
|
|
275
|
-
}, controlledKeypadMode && /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
|
|
276
|
-
label: "Equation Editor",
|
|
277
|
-
className: classes.selectContainer
|
|
278
|
-
}, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
279
|
-
className: classes.select,
|
|
280
|
-
onChange: this.onEditorTypeChange,
|
|
281
|
-
value: this.state.equationEditor
|
|
282
|
-
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
283
|
-
value: "non-negative-integers"
|
|
284
|
-
}, "Numeric - Non-Negative Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
285
|
-
value: "integers"
|
|
286
|
-
}, "Numeric - Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
287
|
-
value: "decimals"
|
|
288
|
-
}, "Numeric - Decimals"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
289
|
-
value: "fractions"
|
|
290
|
-
}, "Numeric - Fractions"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
291
|
-
value: 1
|
|
292
|
-
}, "Grade 1 - 2"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
293
|
-
value: 3
|
|
294
|
-
}, "Grade 3 - 5"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
295
|
-
value: 6
|
|
296
|
-
}, "Grade 6 - 7"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
297
|
-
value: 8
|
|
298
|
-
}, "Grade 8 - HS"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
299
|
-
value: 'geometry'
|
|
300
|
-
}, "Geometry"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
301
|
-
value: 'advanced-algebra'
|
|
302
|
-
}, "Advanced Algebra"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
303
|
-
value: 'statistics'
|
|
304
|
-
}, "Statistics"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
305
|
-
value: 'item-authoring'
|
|
306
|
-
}, "Item Authoring"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
307
|
-
className: (0, _classnames["default"])(classes.inputContainer, error ? classes.error : '')
|
|
308
|
-
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Input, {
|
|
309
|
-
onFocus: function onFocus() {
|
|
310
|
-
_onFocus && _onFocus();
|
|
311
|
-
|
|
312
|
-
_this2.updateDisable(false);
|
|
313
|
-
},
|
|
314
|
-
onBlur: function onBlur(event) {
|
|
315
|
-
_this2.updateDisable(false);
|
|
316
|
-
|
|
317
|
-
_onBlur && _onBlur(event);
|
|
318
|
-
},
|
|
319
|
-
className: (0, _classnames["default"])(classes.mathEditor, classNames.editor, !controlledKeypadMode ? classes.longMathEditor : ''),
|
|
320
|
-
innerRef: function innerRef(r) {
|
|
321
|
-
return _this2.input = r;
|
|
322
|
-
},
|
|
323
|
-
latex: latex,
|
|
324
|
-
onChange: this.onEditorChange
|
|
325
|
-
}))), allowAnswerBlock && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
326
|
-
className: classes.addAnswerBlockButton,
|
|
327
|
-
type: "primary",
|
|
328
|
-
style: {
|
|
329
|
-
bottom: shouldShowKeypad ? '320px' : '20px'
|
|
330
|
-
},
|
|
331
|
-
onClick: this.onAnswerBlockClick,
|
|
332
|
-
disabled: addDisabled
|
|
333
|
-
}, "+ Response Area"), /*#__PURE__*/_react["default"].createElement("hr", {
|
|
334
|
-
className: classes.hr
|
|
335
|
-
}), shouldShowKeypad && /*#__PURE__*/_react["default"].createElement(_mathInput.HorizontalKeypad, {
|
|
336
|
-
className: (0, _classnames["default"])(classes[keypadMode], classes.keyboard),
|
|
337
|
-
layoutForKeyPad: layoutForKeyPad,
|
|
338
|
-
additionalKeys: additionalKeys,
|
|
339
|
-
mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
|
|
340
|
-
onClick: this.onClick,
|
|
341
|
-
noDecimal: noDecimal
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
}]);
|
|
345
|
-
return EditorAndPad;
|
|
346
|
-
}(_react["default"].Component);
|
|
347
|
-
|
|
348
|
-
exports.EditorAndPad = EditorAndPad;
|
|
349
|
-
(0, _defineProperty2["default"])(EditorAndPad, "propTypes", {
|
|
350
|
-
classNames: _propTypes["default"].object,
|
|
351
|
-
keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
352
|
-
autoFocus: _propTypes["default"].bool,
|
|
353
|
-
allowAnswerBlock: _propTypes["default"].bool,
|
|
354
|
-
showKeypad: _propTypes["default"].bool,
|
|
355
|
-
controlledKeypad: _propTypes["default"].bool,
|
|
356
|
-
controlledKeypadMode: _propTypes["default"].bool,
|
|
357
|
-
error: _propTypes["default"].string,
|
|
358
|
-
noDecimal: _propTypes["default"].bool,
|
|
359
|
-
hideInput: _propTypes["default"].bool,
|
|
360
|
-
noLatexHandling: _propTypes["default"].bool,
|
|
361
|
-
layoutForKeyPad: _propTypes["default"].object,
|
|
362
|
-
maxResponseAreas: _propTypes["default"].number,
|
|
363
|
-
additionalKeys: _propTypes["default"].array,
|
|
364
|
-
latex: _propTypes["default"].string.isRequired,
|
|
365
|
-
onAnswerBlockAdd: _propTypes["default"].func,
|
|
366
|
-
onFocus: _propTypes["default"].func,
|
|
367
|
-
onBlur: _propTypes["default"].func,
|
|
368
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
369
|
-
classes: _propTypes["default"].object
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
var styles = function styles(theme) {
|
|
373
|
-
return {
|
|
374
|
-
inputAndTypeContainer: {
|
|
375
|
-
display: 'flex',
|
|
376
|
-
alignItems: 'center',
|
|
377
|
-
'& .mq-editable-field .mq-cursor': {
|
|
378
|
-
top: '-4px'
|
|
379
|
-
},
|
|
380
|
-
'& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection': {
|
|
381
|
-
paddingTop: '18px'
|
|
382
|
-
},
|
|
383
|
-
'& .mq-math-mode .mq-overarrow': {
|
|
384
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
385
|
-
},
|
|
386
|
-
'& .mq-math-mode .mq-overline .mq-overline-inner': {
|
|
387
|
-
paddingTop: '0.4em !important'
|
|
388
|
-
},
|
|
389
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
390
|
-
minWidth: '1.23em',
|
|
391
|
-
'& *': {
|
|
392
|
-
lineHeight: '1 !important'
|
|
393
|
-
},
|
|
394
|
-
'&:before': {
|
|
395
|
-
top: '-0.45em',
|
|
396
|
-
left: '-1px'
|
|
397
|
-
},
|
|
398
|
-
'&:after': {
|
|
399
|
-
position: 'absolute',
|
|
400
|
-
top: '0px !important',
|
|
401
|
-
right: '-2px'
|
|
402
|
-
},
|
|
403
|
-
'&.mq-empty:after': {
|
|
404
|
-
top: '-0.45em'
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
408
|
-
'&:before': {
|
|
409
|
-
top: '-0.4em',
|
|
410
|
-
right: '-1px'
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
'& *': {
|
|
414
|
-
fontFamily: 'MJXZERO, MJXTEX !important',
|
|
415
|
-
'& .mq-math-mode > span > var': {
|
|
416
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
417
|
-
},
|
|
418
|
-
'& .mq-math-mode span var': {
|
|
419
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
420
|
-
},
|
|
421
|
-
'& .mq-math-mode .mq-nonSymbola': {
|
|
422
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
423
|
-
},
|
|
424
|
-
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
425
|
-
fontFamily: 'MJXZERO, MJXTEX !important'
|
|
426
|
-
},
|
|
427
|
-
'& .mq-math-mode .mq-sqrt-prefix': {
|
|
428
|
-
verticalAlign: 'baseline !important',
|
|
429
|
-
top: '1px !important',
|
|
430
|
-
left: '-0.1em !important'
|
|
431
|
-
},
|
|
432
|
-
'& .mq-math-mode .mq-overarc ': {
|
|
433
|
-
paddingTop: '0.45em !important'
|
|
434
|
-
},
|
|
435
|
-
'& .mq-math-mode sup.mq-nthroot': {
|
|
436
|
-
fontSize: '70% !important',
|
|
437
|
-
verticalAlign: '0.5em !important',
|
|
438
|
-
paddingRight: '0.15em'
|
|
439
|
-
},
|
|
440
|
-
'& .mq-math-mode .mq-empty': {
|
|
441
|
-
padding: '9px 1px !important'
|
|
442
|
-
},
|
|
443
|
-
'& .mq-math-mode .mq-root-block': {
|
|
444
|
-
paddingTop: '10px'
|
|
445
|
-
},
|
|
446
|
-
'& .mq-scaled .mq-sqrt-prefix': {
|
|
447
|
-
top: '0 !important'
|
|
448
|
-
},
|
|
449
|
-
'& .mq-longdiv-inner': {
|
|
450
|
-
marginTop: '-1px',
|
|
451
|
-
marginLeft: '5px !important;',
|
|
452
|
-
'& > .mq-empty': {
|
|
453
|
-
padding: '0 !important',
|
|
454
|
-
marginLeft: '0px !important',
|
|
455
|
-
marginTop: '2px'
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
'& .mq-math-mode .mq-longdiv': {
|
|
459
|
-
display: 'inline-flex !important'
|
|
460
|
-
},
|
|
461
|
-
'& .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
|
|
462
|
-
marginLeft: '4px !important',
|
|
463
|
-
paddingTop: '6px !important',
|
|
464
|
-
paddingLeft: '6px !important'
|
|
465
|
-
},
|
|
466
|
-
'& .mq-math-mode .mq-supsub': {
|
|
467
|
-
fontSize: '70.7% !important'
|
|
468
|
-
},
|
|
469
|
-
'& .mq-math-mode .mq-paren': {
|
|
470
|
-
verticalAlign: 'top !important',
|
|
471
|
-
padding: '1px 0.1em !important'
|
|
472
|
-
},
|
|
473
|
-
'& .mq-math-mode .mq-sqrt-stem': {
|
|
474
|
-
borderTop: '0.07em solid',
|
|
475
|
-
marginLeft: '-1.5px',
|
|
476
|
-
marginTop: '-2px !important',
|
|
477
|
-
paddingTop: '5px !important'
|
|
478
|
-
},
|
|
479
|
-
'& .mq-supsub ': {
|
|
480
|
-
fontSize: '70.7%'
|
|
481
|
-
},
|
|
482
|
-
'& .mq-math-mode .mq-supsub.mq-sup-only': {
|
|
483
|
-
verticalAlign: '-0.1em !important',
|
|
484
|
-
'& .mq-sup': {
|
|
485
|
-
marginBottom: '0px !important'
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
'& .mq-math-mode .mq-denominator': {
|
|
489
|
-
marginTop: '-5px !important',
|
|
490
|
-
padding: '0.5em 0.1em 0.1em !important'
|
|
491
|
-
},
|
|
492
|
-
'& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
|
|
493
|
-
padding: '0 0.1em !important',
|
|
494
|
-
paddingBottom: '0 !important',
|
|
495
|
-
marginBottom: '-2px'
|
|
496
|
-
},
|
|
497
|
-
'-webkit-font-smoothing': 'antialiased !important'
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
hide: {
|
|
501
|
-
display: 'none'
|
|
502
|
-
},
|
|
503
|
-
selectContainer: {
|
|
504
|
-
flex: 'initial',
|
|
505
|
-
width: '25%',
|
|
506
|
-
minWidth: '100px',
|
|
507
|
-
marginLeft: '15px',
|
|
508
|
-
marginTop: '5px',
|
|
509
|
-
marginBottom: '5px',
|
|
510
|
-
marginRight: '5px',
|
|
511
|
-
'& label': {
|
|
512
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
513
|
-
},
|
|
514
|
-
'& div': {
|
|
515
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
mathEditor: {
|
|
519
|
-
maxWidth: '400px',
|
|
520
|
-
color: _renderUi.color.text(),
|
|
521
|
-
backgroundColor: _renderUi.color.background(),
|
|
522
|
-
padding: '2px'
|
|
523
|
-
},
|
|
524
|
-
longMathEditor: {
|
|
525
|
-
maxWidth: '500px'
|
|
526
|
-
},
|
|
527
|
-
addAnswerBlockButton: {
|
|
528
|
-
position: 'absolute',
|
|
529
|
-
right: '12px',
|
|
530
|
-
border: '1px solid lightgrey'
|
|
531
|
-
},
|
|
532
|
-
hr: {
|
|
533
|
-
padding: 0,
|
|
534
|
-
margin: 0,
|
|
535
|
-
height: '1px',
|
|
536
|
-
border: 'none',
|
|
537
|
-
borderBottom: "solid 1px ".concat(theme.palette.primary.main)
|
|
538
|
-
},
|
|
539
|
-
mathToolbar: {
|
|
540
|
-
zIndex: 9,
|
|
541
|
-
position: 'relative',
|
|
542
|
-
textAlign: 'center',
|
|
543
|
-
width: 'auto',
|
|
544
|
-
'& > .mq-math-mode': {
|
|
545
|
-
border: 'solid 1px lightgrey'
|
|
546
|
-
},
|
|
547
|
-
'& > .mq-focused': {
|
|
548
|
-
outline: 'none',
|
|
549
|
-
boxShadow: 'none',
|
|
550
|
-
border: "dotted 1px ".concat(theme.palette.primary.main),
|
|
551
|
-
borderRadius: '0px'
|
|
552
|
-
},
|
|
553
|
-
'& .mq-overarrow-inner': {
|
|
554
|
-
border: 'none !important',
|
|
555
|
-
paddingTop: '0 !important'
|
|
556
|
-
},
|
|
557
|
-
'& .mq-overarrow-inner-right': {
|
|
558
|
-
display: 'none !important'
|
|
559
|
-
},
|
|
560
|
-
'& .mq-overarrow-inner-left': {
|
|
561
|
-
display: 'none !important'
|
|
562
|
-
},
|
|
563
|
-
'& .mq-longdiv-inner': {
|
|
564
|
-
borderTop: '1px solid !important',
|
|
565
|
-
paddingTop: '1.5px !important'
|
|
566
|
-
},
|
|
567
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
568
|
-
top: '7.8px',
|
|
569
|
-
marginTop: '0px',
|
|
570
|
-
minWidth: '1.23em'
|
|
571
|
-
},
|
|
572
|
-
'& .mq-parallelogram': {
|
|
573
|
-
lineHeight: 0.85
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
inputContainer: {
|
|
577
|
-
minWidth: '500px',
|
|
578
|
-
maxWidth: '900px',
|
|
579
|
-
minHeight: '30px',
|
|
580
|
-
width: '100%',
|
|
581
|
-
display: 'flex',
|
|
582
|
-
marginTop: theme.spacing.unit,
|
|
583
|
-
marginBottom: theme.spacing.unit,
|
|
584
|
-
'& .mq-sqrt-prefix .mq-scaled': {
|
|
585
|
-
verticalAlign: 'middle !important'
|
|
586
|
-
}
|
|
587
|
-
},
|
|
588
|
-
error: {
|
|
589
|
-
border: '2px solid red'
|
|
590
|
-
},
|
|
591
|
-
keyboard: {
|
|
592
|
-
'& *': {
|
|
593
|
-
fontFamily: 'MJXZERO, MJXTEX !important',
|
|
594
|
-
'& .mq-math-mode > span > var': {
|
|
595
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
596
|
-
},
|
|
597
|
-
'& .mq-math-mode span var': {
|
|
598
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
599
|
-
},
|
|
600
|
-
'& .mq-math-mode .mq-nonSymbola': {
|
|
601
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
602
|
-
},
|
|
603
|
-
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
604
|
-
fontFamily: 'MJXZERO, MJXTEX !important'
|
|
605
|
-
},
|
|
606
|
-
'& .mq-math-mode .mq-sqrt-prefix': {
|
|
607
|
-
top: '0 !important'
|
|
608
|
-
},
|
|
609
|
-
'& .mq-math-mode .mq-empty': {
|
|
610
|
-
padding: '9px 1px !important'
|
|
611
|
-
},
|
|
612
|
-
'& .mq-longdiv-inner': {
|
|
613
|
-
marginTop: '-1px',
|
|
614
|
-
marginLeft: '5px !important;',
|
|
615
|
-
'& > .mq-empty': {
|
|
616
|
-
padding: '0 !important',
|
|
617
|
-
marginLeft: '0px !important',
|
|
618
|
-
marginTop: '2px'
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
'& .mq-math-mode .mq-longdiv': {
|
|
622
|
-
display: 'inline-flex !important'
|
|
623
|
-
},
|
|
624
|
-
'& .mq-math-mode .mq-supsub': {
|
|
625
|
-
fontSize: '70.7% !important'
|
|
626
|
-
},
|
|
627
|
-
'& .mq-math-mode .mq-sqrt-stem': {
|
|
628
|
-
marginTop: '-5px',
|
|
629
|
-
paddingTop: '4px'
|
|
630
|
-
},
|
|
631
|
-
'& .mq-math-mode .mq-paren': {
|
|
632
|
-
verticalAlign: 'middle !important'
|
|
633
|
-
},
|
|
634
|
-
'& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty': {
|
|
635
|
-
padding: '0 !important'
|
|
636
|
-
},
|
|
637
|
-
'& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ': {
|
|
638
|
-
padding: '0 !important'
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
language: {
|
|
643
|
-
'& *': {
|
|
644
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
var _default = (0, _styles.withStyles)(styles)(EditorAndPad);
|
|
651
|
-
|
|
652
|
-
exports["default"] = _default;
|
|
653
|
-
//# sourceMappingURL=editor-and-pad.js.map
|