@pie-element/math-inline 11.0.5-esm.0 → 11.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/configure/CHANGELOG.md +69 -0
- package/configure/lib/configure.js +162 -240
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +8 -8
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +447 -564
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +111 -176
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/response.js +330 -388
- package/configure/lib/response.js.map +1 -1
- package/configure/lib/utils.js +15 -30
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +14 -12
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/defaults.js +5 -8
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +189 -278
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +1 -2
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +7 -7
- package/lib/index.js +72 -125
- package/lib/index.js.map +1 -1
- package/lib/main.js +784 -889
- package/lib/main.js.map +1 -1
- package/lib/print.js +43 -84
- package/lib/print.js.map +1 -1
- package/lib/simple-question-block.js +125 -162
- package/lib/simple-question-block.js.map +1 -1
- package/lib/utils.js +1 -2
- package/lib/utils.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/controller.js +2319 -2930
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +7 -3
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +21 -33
- package/esm/configure.css +0 -847
- package/esm/configure.js +0 -1769
- package/esm/configure.js.map +0 -1
- package/esm/controller.css +0 -847
- package/esm/controller.js +0 -416
- package/esm/controller.js.map +0 -1
- package/esm/element.css +0 -847
- package/esm/element.js +0 -1476
- package/esm/element.js.map +0 -1
- package/esm/print.css +0 -847
- package/esm/print.js +0 -1288
- package/esm/print.js.map +0 -1
|
@@ -1,307 +1,248 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
7
|
+
exports.default = void 0;
|
|
26
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
9
|
var React = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
35
|
-
|
|
12
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
36
13
|
var _configUi = require("@pie-lib/config-ui");
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
43
|
-
|
|
44
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
45
|
-
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
16
|
+
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
17
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
46
18
|
var _response = _interopRequireDefault(require("./response"));
|
|
47
|
-
|
|
48
19
|
var _mathToolbar = require("@pie-lib/math-toolbar");
|
|
49
|
-
|
|
50
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
51
|
-
|
|
20
|
+
var _lodashEs = require("lodash-es");
|
|
52
21
|
var _utils = require("./utils");
|
|
53
|
-
|
|
54
22
|
var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
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; }
|
|
65
|
-
|
|
66
|
-
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; }
|
|
67
|
-
|
|
68
|
-
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); }; }
|
|
69
|
-
|
|
70
|
-
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; } }
|
|
71
|
-
|
|
72
|
-
var registered = false;
|
|
73
|
-
|
|
74
|
-
var styles = function styles(theme) {
|
|
23
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
24
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
|
+
let registered = false;
|
|
27
|
+
|
|
28
|
+
// Helper function to get class names for HTML string generation
|
|
29
|
+
const getBlockClassNames = () => {
|
|
30
|
+
// These will be generated by styled components, but we need them as strings for HTML
|
|
31
|
+
// We'll use a simple approach: generate unique class names
|
|
75
32
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
templateTitle: {
|
|
81
|
-
fontSize: '0.85rem'
|
|
82
|
-
},
|
|
83
|
-
title: {
|
|
84
|
-
fontSize: '1.1rem'
|
|
85
|
-
},
|
|
86
|
-
addResponseButton: {
|
|
87
|
-
border: "1px solid ".concat(theme.palette.grey['A100']),
|
|
88
|
-
"float": 'right',
|
|
89
|
-
width: '150px'
|
|
90
|
-
},
|
|
91
|
-
flexContainer: {
|
|
92
|
-
display: 'flex',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
justifyContent: 'space-between'
|
|
95
|
-
},
|
|
96
|
-
selectContainer: {
|
|
97
|
-
flex: 'initial',
|
|
98
|
-
width: '40%',
|
|
99
|
-
marginTop: theme.spacing.unit * 2,
|
|
100
|
-
marginBottom: theme.spacing.unit * 2
|
|
101
|
-
},
|
|
102
|
-
responseTemplate: {
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'column'
|
|
105
|
-
},
|
|
106
|
-
responseEditor: {
|
|
107
|
-
display: 'flex',
|
|
108
|
-
justifyContent: 'center',
|
|
109
|
-
width: '100%',
|
|
110
|
-
// minWidth: '500px',
|
|
111
|
-
maxWidth: 'inherit',
|
|
112
|
-
height: 'auto',
|
|
113
|
-
minHeight: '130px',
|
|
114
|
-
textAlign: 'left',
|
|
115
|
-
padding: theme.spacing.unit
|
|
116
|
-
},
|
|
117
|
-
promptHolder: {
|
|
118
|
-
width: '100%',
|
|
119
|
-
paddingTop: theme.spacing.unit * 2,
|
|
120
|
-
marginBottom: theme.spacing.unit * 2
|
|
121
|
-
},
|
|
122
|
-
blockContainer: {
|
|
123
|
-
margin: theme.spacing.unit,
|
|
124
|
-
display: 'inline-flex',
|
|
125
|
-
border: '2px solid grey'
|
|
126
|
-
},
|
|
127
|
-
blockContainerGeneric: {
|
|
128
|
-
margin: theme.spacing.unit / 2
|
|
129
|
-
},
|
|
130
|
-
blockResponse: {
|
|
131
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
132
|
-
flex: 2,
|
|
133
|
-
color: 'grey',
|
|
134
|
-
background: theme.palette.grey['A100'],
|
|
135
|
-
fontSize: '0.8rem',
|
|
136
|
-
padding: theme.spacing.unit / 2,
|
|
137
|
-
display: 'flex',
|
|
138
|
-
alignItems: 'center',
|
|
139
|
-
justifyContent: 'center',
|
|
140
|
-
borderRight: '2px solid grey'
|
|
141
|
-
},
|
|
142
|
-
blockResponseGeneric: {
|
|
143
|
-
borderRight: 0
|
|
144
|
-
},
|
|
145
|
-
blockMath: {
|
|
146
|
-
color: theme.palette.grey[400],
|
|
147
|
-
padding: theme.spacing.unit / 2,
|
|
148
|
-
display: 'flex',
|
|
149
|
-
alignItems: 'center',
|
|
150
|
-
justifyContent: 'center',
|
|
151
|
-
flex: 8,
|
|
152
|
-
'& > .mq-math-mode': {
|
|
153
|
-
'& > .mq-hasCursor': {
|
|
154
|
-
'& > .mq-cursor': {
|
|
155
|
-
display: 'none'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
tooltip: {
|
|
161
|
-
fontSize: theme.typography.fontSize - 2,
|
|
162
|
-
whiteSpace: 'pre-wrap'
|
|
163
|
-
},
|
|
164
|
-
errorText: {
|
|
165
|
-
fontSize: theme.typography.fontSize - 2,
|
|
166
|
-
color: theme.palette.error.main,
|
|
167
|
-
paddingTop: theme.spacing.unit
|
|
168
|
-
},
|
|
169
|
-
advancedResponse: {
|
|
170
|
-
marginBottom: theme.spacing.unit * 2.5
|
|
171
|
-
}
|
|
33
|
+
blockContainer: 'block-container',
|
|
34
|
+
blockContainerGeneric: 'block-container-generic',
|
|
35
|
+
blockResponse: 'block-response',
|
|
36
|
+
blockResponseGeneric: 'block-response-generic'
|
|
172
37
|
};
|
|
173
38
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
39
|
+
const Container = (0, _styles.styled)('div')({
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column'
|
|
42
|
+
});
|
|
43
|
+
const TemplateTitle = (0, _styles.styled)(_InputLabel.default)({
|
|
44
|
+
fontSize: '0.85rem'
|
|
45
|
+
});
|
|
46
|
+
const Title = (0, _styles.styled)('div')({
|
|
47
|
+
fontSize: '1.1rem'
|
|
48
|
+
});
|
|
49
|
+
const FlexContainer = (0, _styles.styled)('div')({
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'space-between'
|
|
53
|
+
});
|
|
54
|
+
const SelectContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
55
|
+
theme
|
|
56
|
+
}) => ({
|
|
57
|
+
flex: 'initial',
|
|
58
|
+
width: '40%',
|
|
59
|
+
marginTop: theme.spacing(2),
|
|
60
|
+
marginBottom: theme.spacing(2),
|
|
61
|
+
'& > *:not(label)': {
|
|
62
|
+
marginTop: theme.spacing(1)
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
const ResponseTemplate = (0, _styles.styled)('div')({
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column'
|
|
68
|
+
});
|
|
69
|
+
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
70
|
+
theme
|
|
71
|
+
}) => ({
|
|
72
|
+
'& .MuiTooltip-tooltip': {
|
|
73
|
+
fontSize: theme.typography.fontSize - 2,
|
|
74
|
+
whiteSpace: 'pre-wrap'
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
78
|
+
theme
|
|
79
|
+
}) => ({
|
|
80
|
+
fontSize: theme.typography.fontSize - 2,
|
|
81
|
+
color: theme.palette.error.main,
|
|
82
|
+
paddingTop: theme.spacing(1)
|
|
83
|
+
}));
|
|
84
|
+
const PromptHolder = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
85
|
+
theme
|
|
86
|
+
}) => ({
|
|
87
|
+
width: '100%',
|
|
88
|
+
paddingTop: theme.spacing(2),
|
|
89
|
+
marginBottom: theme.spacing(2)
|
|
90
|
+
}));
|
|
91
|
+
const AdvancedResponse = (0, _styles.styled)('div')(({
|
|
92
|
+
theme
|
|
93
|
+
}) => ({
|
|
94
|
+
marginBottom: theme.spacing(2.5)
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
// CSS for block classes used in HTML string generation
|
|
98
|
+
// These need to be injected as global styles since they're used in dynamically generated HTML
|
|
99
|
+
if (typeof document !== 'undefined') {
|
|
100
|
+
const styleId = 'math-inline-block-styles';
|
|
101
|
+
if (!document.getElementById(styleId)) {
|
|
102
|
+
const style = document.createElement('style');
|
|
103
|
+
style.id = styleId;
|
|
104
|
+
style.textContent = `
|
|
105
|
+
.block-container {
|
|
106
|
+
margin: 8px;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
border: 2px solid grey;
|
|
109
|
+
}
|
|
110
|
+
.block-container-generic {
|
|
111
|
+
margin: 4px;
|
|
112
|
+
}
|
|
113
|
+
.block-response {
|
|
114
|
+
flex: 2;
|
|
115
|
+
color: grey;
|
|
116
|
+
background: #f5f5f5;
|
|
117
|
+
font-size: 0.8rem;
|
|
118
|
+
padding: 4px;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
border-right: 2px solid grey;
|
|
123
|
+
}
|
|
124
|
+
.block-response-generic {
|
|
125
|
+
border-right: 0;
|
|
126
|
+
}
|
|
127
|
+
.response-editor {
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: 100%;
|
|
131
|
+
max-width: inherit;
|
|
132
|
+
height: auto;
|
|
133
|
+
min-height: 130px;
|
|
134
|
+
text-align: left;
|
|
135
|
+
padding: 8px;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
document.head.appendChild(style);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const REGEX = /{{response}}/gm;
|
|
142
|
+
const TEMPORARY_RESPONSE_FIELD = /\\%response\\%/gm;
|
|
143
|
+
const ANSWER_BLOCK_REGEX = /\\embed\{answerBlock\}\[r\d*\]/g;
|
|
144
|
+
const NEWLINE_BLOCK = /\\embed\{newLine\}\[\]/g;
|
|
145
|
+
const NEWLINE_LATEX = /\\newline/g;
|
|
181
146
|
function prepareForStatic(expression) {
|
|
182
147
|
if (expression) {
|
|
183
|
-
|
|
148
|
+
let answerBlocks = 1; // assume one at least
|
|
184
149
|
|
|
185
|
-
return expression.replace(REGEX,
|
|
186
|
-
return "\\embed{answerBlock}[r".concat(answerBlocks++, "]");
|
|
187
|
-
}).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
150
|
+
return expression.replace(REGEX, () => `\\embed{answerBlock}[r${answerBlocks++}]`).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
188
151
|
}
|
|
189
152
|
}
|
|
190
|
-
|
|
191
153
|
function prepareForModel(expression) {
|
|
192
154
|
if (expression) {
|
|
193
|
-
return expression.replace(ANSWER_BLOCK_REGEX,
|
|
194
|
-
return '{{response}}';
|
|
195
|
-
}).replace(TEMPORARY_RESPONSE_FIELD, function () {
|
|
196
|
-
return '{{response}}';
|
|
197
|
-
}).replace(NEWLINE_BLOCK, function () {
|
|
198
|
-
return '\\newline';
|
|
199
|
-
});
|
|
155
|
+
return expression.replace(ANSWER_BLOCK_REGEX, () => '{{response}}').replace(TEMPORARY_RESPONSE_FIELD, () => '{{response}}').replace(NEWLINE_BLOCK, () => '\\newline');
|
|
200
156
|
}
|
|
201
157
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
_this = _super.call(this, props);
|
|
213
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (name) {
|
|
214
|
-
return function (evtOrValue) {
|
|
215
|
-
var _this$props = _this.props,
|
|
216
|
-
model = _this$props.model,
|
|
217
|
-
onChange = _this$props.onChange;
|
|
218
|
-
|
|
219
|
-
var newModel = _objectSpread({}, model);
|
|
220
|
-
|
|
221
|
-
if ((0, _typeof2["default"])(evtOrValue) === 'object') {
|
|
222
|
-
newModel[name] = evtOrValue.target.value;
|
|
223
|
-
} else {
|
|
224
|
-
newModel[name] = evtOrValue;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (name === 'expression') {
|
|
228
|
-
newModel[name] = prepareForModel(evtOrValue);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
onChange(newModel);
|
|
158
|
+
class GeneralConfigBlock extends React.Component {
|
|
159
|
+
constructor(props) {
|
|
160
|
+
super(props);
|
|
161
|
+
(0, _defineProperty2.default)(this, "onChange", name => evtOrValue => {
|
|
162
|
+
const {
|
|
163
|
+
model,
|
|
164
|
+
onChange
|
|
165
|
+
} = this.props;
|
|
166
|
+
const newModel = {
|
|
167
|
+
...model
|
|
232
168
|
};
|
|
169
|
+
if (typeof evtOrValue === 'object') {
|
|
170
|
+
newModel[name] = evtOrValue.target.value;
|
|
171
|
+
} else {
|
|
172
|
+
newModel[name] = evtOrValue;
|
|
173
|
+
}
|
|
174
|
+
if (name === 'expression') {
|
|
175
|
+
newModel[name] = prepareForModel(evtOrValue);
|
|
176
|
+
}
|
|
177
|
+
onChange(newModel);
|
|
233
178
|
});
|
|
234
|
-
(0, _defineProperty2
|
|
235
|
-
|
|
179
|
+
(0, _defineProperty2.default)(this, "onDone", () => {
|
|
180
|
+
this.setState({
|
|
236
181
|
showKeypad: false
|
|
237
182
|
});
|
|
238
183
|
});
|
|
239
|
-
(0, _defineProperty2
|
|
240
|
-
|
|
184
|
+
(0, _defineProperty2.default)(this, "onFocus", () => {
|
|
185
|
+
this.setState({
|
|
241
186
|
showKeypad: true
|
|
242
187
|
});
|
|
243
188
|
});
|
|
244
|
-
(0, _defineProperty2
|
|
245
|
-
|
|
189
|
+
(0, _defineProperty2.default)(this, "onPromptFocus", () => {
|
|
190
|
+
this.setState({
|
|
246
191
|
showKeypad: false
|
|
247
192
|
});
|
|
248
193
|
});
|
|
249
|
-
(0, _defineProperty2
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
194
|
+
(0, _defineProperty2.default)(this, "handleAnswerBlockDomUpdate", () => {
|
|
195
|
+
const {
|
|
196
|
+
model
|
|
197
|
+
} = this.props;
|
|
198
|
+
const responseAreas = {};
|
|
253
199
|
if (model && model.expression) {
|
|
254
|
-
|
|
200
|
+
let answerBlocks = 1; // assume one at least
|
|
255
201
|
// build out local state model using responses declared in expression
|
|
256
202
|
|
|
257
|
-
model.expression.replace(REGEX,
|
|
258
|
-
responseAreas[
|
|
203
|
+
model.expression.replace(REGEX, () => {
|
|
204
|
+
responseAreas[`r${answerBlocks++}`] = {
|
|
259
205
|
value: ''
|
|
260
206
|
};
|
|
261
207
|
});
|
|
262
208
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
var indexEl = _this.root.querySelector("#".concat(responseId, "Index"));
|
|
273
|
-
|
|
209
|
+
if (!(0, _lodashEs.isEqual)(responseAreas, this.state.responseAreas)) {
|
|
210
|
+
this.setState({
|
|
211
|
+
responseAreas
|
|
212
|
+
}, () => {
|
|
213
|
+
if (this.root && Object.keys(responseAreas).length) {
|
|
214
|
+
Object.keys(responseAreas).forEach((responseId, idx) => {
|
|
215
|
+
const el = this.root.querySelector(`#${responseId}`);
|
|
216
|
+
const indexEl = this.root.querySelector(`#${responseId}Index`);
|
|
274
217
|
if (el) {
|
|
275
218
|
// const MathQuill = require('@pie-framework/mathquill');
|
|
276
|
-
|
|
219
|
+
let MQ = _mathquill.default.getInterface(2);
|
|
220
|
+
// We no longer have individual answers, so we cannot set text content of blocks
|
|
277
221
|
// el.textContent = response.answer;
|
|
278
|
-
|
|
279
|
-
|
|
280
222
|
MQ.StaticMath(el);
|
|
281
|
-
indexEl.textContent =
|
|
223
|
+
indexEl.textContent = `R${idx + 1}`;
|
|
282
224
|
}
|
|
283
225
|
});
|
|
284
226
|
}
|
|
285
227
|
});
|
|
286
228
|
}
|
|
287
229
|
});
|
|
288
|
-
(0, _defineProperty2
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
230
|
+
(0, _defineProperty2.default)(this, "onAddResponse", () => {
|
|
231
|
+
const {
|
|
232
|
+
model,
|
|
233
|
+
onChange
|
|
234
|
+
} = this.props;
|
|
235
|
+
const {
|
|
236
|
+
responseIdCounter
|
|
237
|
+
} = this.state;
|
|
238
|
+
const newModel = {
|
|
239
|
+
...model
|
|
240
|
+
};
|
|
241
|
+
let newCounter = responseIdCounter;
|
|
242
|
+
while (model.responses.find(response => response.id === newCounter)) {
|
|
301
243
|
newCounter++;
|
|
302
244
|
}
|
|
303
|
-
|
|
304
|
-
var response = {
|
|
245
|
+
const response = {
|
|
305
246
|
id: newCounter,
|
|
306
247
|
validation: 'literal',
|
|
307
248
|
answer: '',
|
|
@@ -309,345 +250,287 @@ var GeneralConfigBlock = /*#__PURE__*/function (_React$Component) {
|
|
|
309
250
|
};
|
|
310
251
|
newModel.responses = newModel.responses.concat(response);
|
|
311
252
|
onChange(newModel);
|
|
312
|
-
|
|
313
|
-
_this.setState({
|
|
253
|
+
this.setState({
|
|
314
254
|
responseIdCounter: response.id
|
|
315
255
|
});
|
|
316
256
|
});
|
|
317
|
-
(0, _defineProperty2
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
257
|
+
(0, _defineProperty2.default)(this, "onResponseChange", (response, index) => {
|
|
258
|
+
const {
|
|
259
|
+
model,
|
|
260
|
+
onChange
|
|
261
|
+
} = this.props;
|
|
262
|
+
const newModel = {
|
|
263
|
+
...model
|
|
264
|
+
};
|
|
324
265
|
newModel.responses[index] = response;
|
|
325
266
|
onChange(newModel);
|
|
326
267
|
});
|
|
327
|
-
|
|
328
|
-
|
|
268
|
+
const _responseAreas = {};
|
|
329
269
|
if (props.model && props.model.expression) {
|
|
330
|
-
|
|
270
|
+
let answerBlocks = 1; // assume one at least
|
|
331
271
|
// build out local state model using responses declared in expression
|
|
332
272
|
|
|
333
|
-
props.model.expression.replace(REGEX,
|
|
334
|
-
_responseAreas[
|
|
273
|
+
props.model.expression.replace(REGEX, () => {
|
|
274
|
+
_responseAreas[`r${answerBlocks++}`] = {
|
|
335
275
|
value: ''
|
|
336
276
|
};
|
|
337
277
|
});
|
|
338
278
|
}
|
|
339
|
-
|
|
340
|
-
_this.state = {
|
|
279
|
+
this.state = {
|
|
341
280
|
showKeypad: false,
|
|
342
281
|
responseAreas: _responseAreas,
|
|
343
282
|
responseIdCounter: Object.keys(_responseAreas).length
|
|
344
283
|
};
|
|
345
|
-
return _this;
|
|
346
284
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
// </div>
|
|
365
|
-
// </div>`;
|
|
366
|
-
var genericAnswerBlock = "<div class=\"".concat((0, _classnames["default"])(classes.blockContainer, classes.blockContainerGeneric), "\">\n <div class=\"").concat((0, _classnames["default"])(classes.blockResponse, classes.blockResponseGeneric), "\" id=\"").concat(data, "Index\">Response</div>\n </div>");
|
|
367
|
-
return {
|
|
368
|
-
htmlString: genericAnswerBlock,
|
|
369
|
-
text: function text() {
|
|
370
|
-
return 'text';
|
|
371
|
-
},
|
|
372
|
-
latex: function latex() {
|
|
373
|
-
return "\\embed{answerBlock}[".concat(data, "]");
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
});
|
|
377
|
-
registered = true;
|
|
378
|
-
}
|
|
285
|
+
UNSAFE_componentWillMount() {
|
|
286
|
+
if (typeof window !== 'undefined') {
|
|
287
|
+
// const MathQuill = require('@pie-framework/mathquill');
|
|
288
|
+
let MQ = _mathquill.default.getInterface(2);
|
|
289
|
+
if (!registered) {
|
|
290
|
+
MQ.registerEmbed('answerBlock', data => {
|
|
291
|
+
const classNames = getBlockClassNames();
|
|
292
|
+
const genericAnswerBlock = `<div class="${(0, _classnames.default)(classNames.blockContainer, classNames.blockContainerGeneric)}">
|
|
293
|
+
<div class="${(0, _classnames.default)(classNames.blockResponse, classNames.blockResponseGeneric)}" id="${data}Index">Response</div>
|
|
294
|
+
</div>`;
|
|
295
|
+
return {
|
|
296
|
+
htmlString: genericAnswerBlock,
|
|
297
|
+
text: () => 'text',
|
|
298
|
+
latex: () => `\\embed{answerBlock}[${data}]`
|
|
299
|
+
};
|
|
300
|
+
});
|
|
301
|
+
registered = true;
|
|
379
302
|
}
|
|
380
303
|
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
304
|
+
}
|
|
305
|
+
componentDidMount() {
|
|
306
|
+
this.handleAnswerBlockDomUpdate();
|
|
307
|
+
}
|
|
308
|
+
componentDidUpdate() {
|
|
309
|
+
this.handleAnswerBlockDomUpdate();
|
|
310
|
+
}
|
|
311
|
+
render() {
|
|
312
|
+
const {
|
|
313
|
+
model,
|
|
314
|
+
imageSupport,
|
|
315
|
+
uploadSoundSupport,
|
|
316
|
+
configuration,
|
|
317
|
+
promptEnabled,
|
|
318
|
+
rationaleEnabled,
|
|
319
|
+
toolbarOpts
|
|
320
|
+
} = this.props;
|
|
321
|
+
const {
|
|
322
|
+
showKeypad
|
|
323
|
+
} = this.state;
|
|
324
|
+
const {
|
|
325
|
+
prompt,
|
|
326
|
+
expression,
|
|
327
|
+
equationEditor,
|
|
328
|
+
promptEquationEditor = '8',
|
|
329
|
+
responses,
|
|
330
|
+
responseType,
|
|
331
|
+
rationale,
|
|
332
|
+
spellCheckEnabled,
|
|
333
|
+
errors = {}
|
|
334
|
+
} = model;
|
|
335
|
+
const {
|
|
336
|
+
baseInputConfiguration = {},
|
|
337
|
+
rationale: cRationale = {},
|
|
338
|
+
prompt: cPrompt = {},
|
|
339
|
+
ignoreOrder: cIgnoreOrder = {},
|
|
340
|
+
allowTrailingZeros: cAllowTrailingZeros = {},
|
|
341
|
+
maxResponseAreas,
|
|
342
|
+
maxImageWidth = {},
|
|
343
|
+
maxImageHeight = {},
|
|
344
|
+
mathMlOptions = {}
|
|
345
|
+
} = configuration || {};
|
|
346
|
+
const validationMessage = (0, _utils.generateValidationMessage)(configuration, model);
|
|
347
|
+
const {
|
|
348
|
+
prompt: promptError,
|
|
349
|
+
rationale: rationaleError,
|
|
350
|
+
responsesErrors,
|
|
351
|
+
responseAreasError
|
|
352
|
+
} = errors;
|
|
353
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
354
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
355
|
+
const classNames = {
|
|
356
|
+
editor: 'response-editor'
|
|
357
|
+
};
|
|
358
|
+
const responsesToUse = responseType === _utils.ResponseTypes.advanced ? responses : responses.slice(0, 1);
|
|
359
|
+
const validationTooltip = /*#__PURE__*/React.createElement(StyledTooltip, {
|
|
360
|
+
disableFocusListener: true,
|
|
361
|
+
disableTouchListener: true,
|
|
362
|
+
placement: 'right',
|
|
363
|
+
title: validationMessage
|
|
364
|
+
}, /*#__PURE__*/React.createElement(_Info.default, {
|
|
365
|
+
fontSize: 'small',
|
|
366
|
+
color: 'primary',
|
|
367
|
+
style: {
|
|
368
|
+
marginLeft: '5px'
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
372
|
+
ref: r => this.root = r || this.root
|
|
373
|
+
}, promptEnabled && /*#__PURE__*/React.createElement(PromptHolder, {
|
|
374
|
+
label: cPrompt.label
|
|
375
|
+
}, /*#__PURE__*/React.createElement(_editableHtmlTipTap.default, {
|
|
376
|
+
onFocus: this.onPromptFocus,
|
|
377
|
+
markup: prompt || '',
|
|
378
|
+
onChange: this.onChange('prompt'),
|
|
379
|
+
imageSupport: imageSupport,
|
|
380
|
+
nonEmpty: false,
|
|
381
|
+
error: promptError,
|
|
382
|
+
toolbarOpts: toolbarOpts,
|
|
383
|
+
pluginProps: (0, _utils.getPluginProps)(cPrompt?.inputConfiguration, baseInputConfiguration),
|
|
384
|
+
spellCheck: spellCheckEnabled,
|
|
385
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
386
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
387
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
388
|
+
languageCharactersProps: [{
|
|
389
|
+
language: 'spanish'
|
|
390
|
+
}, {
|
|
391
|
+
language: 'special'
|
|
392
|
+
}],
|
|
393
|
+
mathMlOptions: mathMlOptions
|
|
394
|
+
}), promptError && /*#__PURE__*/React.createElement(ErrorText, null, promptError)), responseType === _utils.ResponseTypes.advanced && /*#__PURE__*/React.createElement(AdvancedResponse, null, /*#__PURE__*/React.createElement(FlexContainer, {
|
|
395
|
+
style: {
|
|
396
|
+
justifyContent: 'flex-start'
|
|
397
|
+
}
|
|
398
|
+
}, /*#__PURE__*/React.createElement(Title, null, "Define Response"), validationTooltip), /*#__PURE__*/React.createElement(SelectContainer, {
|
|
399
|
+
key: "templateEditorType",
|
|
400
|
+
label: "Response Template Equation Editor"
|
|
401
|
+
}, /*#__PURE__*/React.createElement(_Select.default, {
|
|
402
|
+
onChange: this.onChange('promptEquationEditor'),
|
|
403
|
+
value: promptEquationEditor,
|
|
404
|
+
MenuProps: {
|
|
405
|
+
transitionDuration: {
|
|
406
|
+
enter: 225,
|
|
407
|
+
exit: 195
|
|
462
408
|
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
409
|
+
}
|
|
410
|
+
}, /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
411
|
+
value: "non-negative-integers"
|
|
412
|
+
}, "Numeric - Non-Negative Integers"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
413
|
+
value: "integers"
|
|
414
|
+
}, "Numeric - Integers"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
415
|
+
value: "decimals"
|
|
416
|
+
}, "Numeric - Decimals"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
417
|
+
value: "fractions"
|
|
418
|
+
}, "Numeric - Fractions"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
419
|
+
value: 1
|
|
420
|
+
}, "Grade 1 - 2"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
421
|
+
value: 3
|
|
422
|
+
}, "Grade 3 - 5"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
423
|
+
value: 6
|
|
424
|
+
}, "Grade 6 - 7"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
425
|
+
value: 8
|
|
426
|
+
}, "Grade 8 - HS"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
427
|
+
value: 'geometry'
|
|
428
|
+
}, "Geometry"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
429
|
+
value: 'advanced-algebra'
|
|
430
|
+
}, "Advanced Algebra"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
431
|
+
value: 'statistics'
|
|
432
|
+
}, "Statistics"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
433
|
+
value: 'item-authoring'
|
|
434
|
+
}, "Item Authoring"))), /*#__PURE__*/React.createElement(ResponseTemplate, {
|
|
435
|
+
key: "templateHolder"
|
|
436
|
+
}, /*#__PURE__*/React.createElement(TemplateTitle, null, "RESPONSE TEMPLATE"), /*#__PURE__*/React.createElement(_mathToolbar.MathToolbar, {
|
|
437
|
+
classNames: classNames,
|
|
438
|
+
allowAnswerBlock: true,
|
|
439
|
+
keypadMode: promptEquationEditor,
|
|
440
|
+
controlledKeypad: true,
|
|
441
|
+
showKeypad: showKeypad,
|
|
442
|
+
latex: prepareForStatic(expression) || '',
|
|
443
|
+
onChange: this.onChange('expression'),
|
|
444
|
+
onFocus: this.onFocus,
|
|
445
|
+
onDone: this.onDone,
|
|
446
|
+
maxResponseAreas: maxResponseAreas,
|
|
447
|
+
error: responseAreasError
|
|
448
|
+
})), responseAreasError && /*#__PURE__*/React.createElement(ErrorText, null, responseAreasError)), /*#__PURE__*/React.createElement(FlexContainer, {
|
|
449
|
+
style: {
|
|
450
|
+
justifyContent: 'flex-start'
|
|
451
|
+
}
|
|
452
|
+
}, /*#__PURE__*/React.createElement(Title, null, "Define Correct Response"), responseType === _utils.ResponseTypes.simple ? validationTooltip : null), /*#__PURE__*/React.createElement(SelectContainer, {
|
|
453
|
+
label: "Equation Editor"
|
|
454
|
+
}, /*#__PURE__*/React.createElement(_Select.default, {
|
|
455
|
+
onChange: this.onChange('equationEditor'),
|
|
456
|
+
value: equationEditor,
|
|
457
|
+
MenuProps: {
|
|
458
|
+
transitionDuration: {
|
|
459
|
+
enter: 225,
|
|
460
|
+
exit: 195
|
|
500
461
|
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
onDone: this.onDone,
|
|
550
|
-
maxResponseAreas: maxResponseAreas,
|
|
551
|
-
error: responseAreasError
|
|
552
|
-
})), responseAreasError && /*#__PURE__*/React.createElement("div", {
|
|
553
|
-
className: classes.errorText
|
|
554
|
-
}, responseAreasError)), /*#__PURE__*/React.createElement("div", {
|
|
555
|
-
className: classes.flexContainer,
|
|
556
|
-
style: {
|
|
557
|
-
justifyContent: 'flex-start'
|
|
462
|
+
}
|
|
463
|
+
}, /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
464
|
+
value: "non-negative-integers"
|
|
465
|
+
}, "Numeric - Non-Negative Integers"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
466
|
+
value: "integers"
|
|
467
|
+
}, "Numeric - Integers"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
468
|
+
value: "decimals"
|
|
469
|
+
}, "Numeric - Decimals"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
470
|
+
value: "fractions"
|
|
471
|
+
}, "Numeric - Fractions"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
472
|
+
value: 1
|
|
473
|
+
}, "Grade 1 - 2"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
474
|
+
value: 3
|
|
475
|
+
}, "Grade 3 - 5"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
476
|
+
value: 6
|
|
477
|
+
}, "Grade 6 - 7"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
478
|
+
value: 8
|
|
479
|
+
}, "Grade 8 - HS"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
480
|
+
value: 'geometry'
|
|
481
|
+
}, "Geometry"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
482
|
+
value: 'advanced-algebra'
|
|
483
|
+
}, "Advanced Algebra"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
484
|
+
value: 'statistics'
|
|
485
|
+
}, "Statistics"), /*#__PURE__*/React.createElement(_MenuItem.default, {
|
|
486
|
+
value: 'item-authoring'
|
|
487
|
+
}, "Item Authoring"))), responsesToUse.map((response, idx) => /*#__PURE__*/React.createElement(_response.default, {
|
|
488
|
+
key: response.id,
|
|
489
|
+
mode: equationEditor,
|
|
490
|
+
response: response,
|
|
491
|
+
defaultResponse: responseType === _utils.ResponseTypes.simple,
|
|
492
|
+
onResponseChange: this.onResponseChange,
|
|
493
|
+
index: idx,
|
|
494
|
+
cIgnoreOrder: cIgnoreOrder,
|
|
495
|
+
cAllowTrailingZeros: cAllowTrailingZeros,
|
|
496
|
+
error: responsesErrors && responsesErrors[idx]
|
|
497
|
+
})), rationaleEnabled && /*#__PURE__*/React.createElement(PromptHolder, {
|
|
498
|
+
label: cRationale.label
|
|
499
|
+
}, /*#__PURE__*/React.createElement(_editableHtmlTipTap.default, {
|
|
500
|
+
markup: rationale || '',
|
|
501
|
+
onChange: this.onChange('rationale'),
|
|
502
|
+
imageSupport: imageSupport,
|
|
503
|
+
nonEmpty: false,
|
|
504
|
+
error: rationaleError,
|
|
505
|
+
toolbarOpts: toolbarOpts,
|
|
506
|
+
pluginProps: (0, _utils.getPluginProps)(cRationale?.inputConfiguration, {
|
|
507
|
+
...baseInputConfiguration,
|
|
508
|
+
math: {
|
|
509
|
+
controlledKeypadMode: false
|
|
558
510
|
}
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}, "Grade 6 - 7"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
583
|
-
value: 8
|
|
584
|
-
}, "Grade 8 - HS"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
585
|
-
value: 'geometry'
|
|
586
|
-
}, "Geometry"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
587
|
-
value: 'advanced-algebra'
|
|
588
|
-
}, "Advanced Algebra"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
589
|
-
value: 'statistics'
|
|
590
|
-
}, "Statistics"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
591
|
-
value: 'item-authoring'
|
|
592
|
-
}, "Item Authoring"))), responsesToUse.map(function (response, idx) {
|
|
593
|
-
return /*#__PURE__*/React.createElement(_response["default"], {
|
|
594
|
-
key: response.id,
|
|
595
|
-
mode: equationEditor,
|
|
596
|
-
response: response,
|
|
597
|
-
defaultResponse: responseType === _utils.ResponseTypes.simple,
|
|
598
|
-
onResponseChange: _this2.onResponseChange,
|
|
599
|
-
index: idx,
|
|
600
|
-
cIgnoreOrder: cIgnoreOrder,
|
|
601
|
-
cAllowTrailingZeros: cAllowTrailingZeros,
|
|
602
|
-
error: responsesErrors && responsesErrors[idx]
|
|
603
|
-
});
|
|
604
|
-
}), rationaleEnabled && /*#__PURE__*/React.createElement(_configUi.InputContainer, {
|
|
605
|
-
label: cRationale.label,
|
|
606
|
-
className: classes.promptHolder
|
|
607
|
-
}, /*#__PURE__*/React.createElement(_editableHtml["default"], {
|
|
608
|
-
className: classes.prompt,
|
|
609
|
-
markup: rationale || '',
|
|
610
|
-
onChange: this.onChange('rationale'),
|
|
611
|
-
imageSupport: imageSupport,
|
|
612
|
-
nonEmpty: false,
|
|
613
|
-
error: rationaleError,
|
|
614
|
-
toolbarOpts: toolbarOpts,
|
|
615
|
-
pluginProps: (0, _utils.getPluginProps)(cRationale === null || cRationale === void 0 ? void 0 : cRationale.inputConfiguration, _objectSpread(_objectSpread({}, baseInputConfiguration), {}, {
|
|
616
|
-
math: {
|
|
617
|
-
controlledKeypadMode: false
|
|
618
|
-
}
|
|
619
|
-
})),
|
|
620
|
-
spellCheck: spellCheckEnabled,
|
|
621
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
622
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
623
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
624
|
-
languageCharactersProps: [{
|
|
625
|
-
language: 'spanish'
|
|
626
|
-
}, {
|
|
627
|
-
language: 'special'
|
|
628
|
-
}],
|
|
629
|
-
mathMlOptions: mathMlOptions
|
|
630
|
-
}), rationaleError && /*#__PURE__*/React.createElement("div", {
|
|
631
|
-
className: classes.errorText
|
|
632
|
-
}, rationaleError)));
|
|
633
|
-
}
|
|
634
|
-
}]);
|
|
635
|
-
return GeneralConfigBlock;
|
|
636
|
-
}(React.Component);
|
|
637
|
-
|
|
638
|
-
(0, _defineProperty2["default"])(GeneralConfigBlock, "propTypes", {
|
|
639
|
-
classes: _propTypes["default"].object.isRequired,
|
|
640
|
-
model: _propTypes["default"].object.isRequired,
|
|
641
|
-
imageSupport: _propTypes["default"].object,
|
|
642
|
-
uploadSoundSupport: _propTypes["default"].object,
|
|
643
|
-
configuration: _propTypes["default"].object,
|
|
644
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
645
|
-
promptEnabled: _propTypes["default"].bool,
|
|
646
|
-
rationaleEnabled: _propTypes["default"].bool,
|
|
647
|
-
toolbarOpts: _propTypes["default"].object
|
|
511
|
+
}),
|
|
512
|
+
spellCheck: spellCheckEnabled,
|
|
513
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
514
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
515
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
516
|
+
languageCharactersProps: [{
|
|
517
|
+
language: 'spanish'
|
|
518
|
+
}, {
|
|
519
|
+
language: 'special'
|
|
520
|
+
}],
|
|
521
|
+
mathMlOptions: mathMlOptions
|
|
522
|
+
}), rationaleError && /*#__PURE__*/React.createElement(ErrorText, null, rationaleError)));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
(0, _defineProperty2.default)(GeneralConfigBlock, "propTypes", {
|
|
526
|
+
model: _propTypes.default.object.isRequired,
|
|
527
|
+
imageSupport: _propTypes.default.object,
|
|
528
|
+
uploadSoundSupport: _propTypes.default.object,
|
|
529
|
+
configuration: _propTypes.default.object,
|
|
530
|
+
onChange: _propTypes.default.func.isRequired,
|
|
531
|
+
promptEnabled: _propTypes.default.bool,
|
|
532
|
+
rationaleEnabled: _propTypes.default.bool,
|
|
533
|
+
toolbarOpts: _propTypes.default.object
|
|
648
534
|
});
|
|
649
|
-
|
|
650
|
-
var _default = (0, _styles.withStyles)(styles)(GeneralConfigBlock);
|
|
651
|
-
|
|
652
|
-
exports["default"] = _default;
|
|
535
|
+
var _default = exports.default = GeneralConfigBlock;
|
|
653
536
|
//# sourceMappingURL=general-config-block.js.map
|