@pie-element/explicit-constructed-response 9.3.4-next.3 → 10.0.0-beta.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/configure/lib/alternateResponses.js +139 -184
- package/configure/lib/alternateResponses.js.map +1 -1
- package/configure/lib/alternateSection.js +272 -369
- package/configure/lib/alternateSection.js.map +1 -1
- package/configure/lib/defaults.js +2 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/ecr-toolbar.js +124 -186
- package/configure/lib/ecr-toolbar.js.map +1 -1
- package/configure/lib/index.js +126 -203
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +434 -550
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +26 -49
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +5 -5
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +9 -7
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +169 -260
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +3 -3
- package/lib/index.js +71 -115
- package/lib/index.js.map +1 -1
- package/lib/main.js +174 -248
- package/lib/main.js.map +1 -1
- package/lib/print.js +39 -83
- package/lib/print.js.map +1 -1
- package/package.json +14 -19
- package/esm/configure.js +0 -33096
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -5144
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -11518
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/print.js +0 -12202
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -7460
- package/module/demo.js +0 -45
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/configure/lib/main.js
CHANGED
|
@@ -1,234 +1,190 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
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 = exports.Main = void 0;
|
|
26
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
9
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
11
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
33
|
-
|
|
34
12
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
35
|
-
|
|
36
13
|
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
37
|
-
|
|
38
14
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
39
|
-
|
|
40
15
|
var _editableHtml = _interopRequireWildcard(require("@pie-lib/editable-html"));
|
|
41
|
-
|
|
42
16
|
var _configUi = require("@pie-lib/config-ui");
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
49
|
-
|
|
50
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
51
|
-
|
|
17
|
+
var _styles = require("@mui/material/styles");
|
|
18
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
19
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
20
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
52
21
|
var _ecrToolbar = _interopRequireDefault(require("./ecr-toolbar"));
|
|
53
|
-
|
|
54
22
|
var _alternateResponses = _interopRequireDefault(require("./alternateResponses"));
|
|
55
|
-
|
|
56
23
|
var _markupUtils = require("./markupUtils");
|
|
57
|
-
|
|
58
24
|
var _utils = require("./utils");
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
flexContainer: {
|
|
118
|
-
display: 'flex',
|
|
119
|
-
alignItems: 'center'
|
|
120
|
-
},
|
|
121
|
-
responseHeader: {
|
|
122
|
-
marginTop: theme.spacing.unit * 3,
|
|
123
|
-
marginBottom: theme.spacing.unit
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
var createElementFromHTML = function createElementFromHTML(htmlString) {
|
|
129
|
-
var div = document.createElement('div');
|
|
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
|
+
const {
|
|
27
|
+
toggle,
|
|
28
|
+
Panel,
|
|
29
|
+
dropdown
|
|
30
|
+
} = _configUi.settings;
|
|
31
|
+
const PromptHolder = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
32
|
+
theme
|
|
33
|
+
}) => ({
|
|
34
|
+
width: '100%',
|
|
35
|
+
paddingTop: theme.spacing(1),
|
|
36
|
+
marginTop: theme.spacing(2),
|
|
37
|
+
marginBottom: theme.spacing(2)
|
|
38
|
+
}));
|
|
39
|
+
const MarkupContainer = (0, _styles.styled)(_editableHtml.default)(({
|
|
40
|
+
theme
|
|
41
|
+
}) => ({
|
|
42
|
+
minHeight: '100px',
|
|
43
|
+
paddingTop: theme.spacing(1),
|
|
44
|
+
width: '100%',
|
|
45
|
+
'& [data-slate-editor="true"]': {
|
|
46
|
+
minHeight: '100px'
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
const StyledText = (0, _styles.styled)(_Typography.default)(({
|
|
50
|
+
theme
|
|
51
|
+
}) => ({
|
|
52
|
+
fontSize: theme.typography.fontSize + 2
|
|
53
|
+
}));
|
|
54
|
+
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
55
|
+
theme
|
|
56
|
+
}) => ({
|
|
57
|
+
'& .MuiTooltip-tooltip': {
|
|
58
|
+
fontSize: theme.typography.fontSize - 2,
|
|
59
|
+
whiteSpace: 'pre',
|
|
60
|
+
maxWidth: '500px'
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
64
|
+
theme
|
|
65
|
+
}) => ({
|
|
66
|
+
fontSize: theme.typography.fontSize - 2,
|
|
67
|
+
color: theme.palette.error.main,
|
|
68
|
+
paddingTop: theme.spacing(1)
|
|
69
|
+
}));
|
|
70
|
+
const FlexContainer = (0, _styles.styled)('div')({
|
|
71
|
+
display: 'flex',
|
|
72
|
+
alignItems: 'center'
|
|
73
|
+
});
|
|
74
|
+
const ResponseHeader = (0, _styles.styled)(_Typography.default)(({
|
|
75
|
+
theme
|
|
76
|
+
}) => ({
|
|
77
|
+
fontSize: theme.typography.fontSize + 2,
|
|
78
|
+
marginTop: theme.spacing(3),
|
|
79
|
+
marginBottom: theme.spacing(1)
|
|
80
|
+
}));
|
|
81
|
+
const createElementFromHTML = htmlString => {
|
|
82
|
+
const div = document.createElement('div');
|
|
130
83
|
div.innerHTML = htmlString.trim();
|
|
131
84
|
return div;
|
|
132
85
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
143
|
-
|
|
144
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
145
|
-
args[_key] = arguments[_key];
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
149
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {});
|
|
150
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChange", function (newVal) {
|
|
151
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), newVal));
|
|
86
|
+
class Main extends _react.default.Component {
|
|
87
|
+
constructor(...args) {
|
|
88
|
+
super(...args);
|
|
89
|
+
(0, _defineProperty2.default)(this, "state", {});
|
|
90
|
+
(0, _defineProperty2.default)(this, "onModelChange", newVal => {
|
|
91
|
+
this.props.onModelChanged({
|
|
92
|
+
...this.props.model,
|
|
93
|
+
...newVal
|
|
94
|
+
});
|
|
152
95
|
});
|
|
153
|
-
(0, _defineProperty2
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
96
|
+
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
97
|
+
this.props.onModelChanged({
|
|
98
|
+
...this.props.model,
|
|
99
|
+
prompt
|
|
100
|
+
});
|
|
157
101
|
});
|
|
158
|
-
(0, _defineProperty2
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
102
|
+
(0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
|
|
103
|
+
this.props.onModelChanged({
|
|
104
|
+
...this.props.model,
|
|
105
|
+
rationale
|
|
106
|
+
});
|
|
162
107
|
});
|
|
163
|
-
(0, _defineProperty2
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
108
|
+
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
109
|
+
const {
|
|
110
|
+
model,
|
|
111
|
+
onModelChanged
|
|
112
|
+
} = this.props;
|
|
113
|
+
onModelChanged({
|
|
114
|
+
...model,
|
|
115
|
+
teacherInstructions
|
|
116
|
+
});
|
|
170
117
|
});
|
|
171
|
-
(0, _defineProperty2
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
118
|
+
(0, _defineProperty2.default)(this, "onMarkupChanged", slateMarkup => {
|
|
119
|
+
this.props.onModelChanged({
|
|
120
|
+
...this.props.model,
|
|
121
|
+
slateMarkup
|
|
122
|
+
});
|
|
175
123
|
});
|
|
176
|
-
(0, _defineProperty2
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
124
|
+
(0, _defineProperty2.default)(this, "onResponsesChanged", choices => {
|
|
125
|
+
this.props.onModelChanged({
|
|
126
|
+
...this.props.model,
|
|
127
|
+
choices
|
|
128
|
+
});
|
|
180
129
|
});
|
|
181
|
-
(0, _defineProperty2
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
130
|
+
(0, _defineProperty2.default)(this, "onLengthChanged", maxLengthPerChoice => {
|
|
131
|
+
const {
|
|
132
|
+
model,
|
|
133
|
+
onModelChanged
|
|
134
|
+
} = this.props;
|
|
135
|
+
onModelChanged({
|
|
136
|
+
...model,
|
|
137
|
+
maxLengthPerChoice
|
|
138
|
+
});
|
|
188
139
|
});
|
|
189
|
-
(0, _defineProperty2
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
140
|
+
(0, _defineProperty2.default)(this, "onChangeResponse", (index, newVal) => {
|
|
141
|
+
const {
|
|
142
|
+
model,
|
|
143
|
+
onModelChanged
|
|
144
|
+
} = this.props;
|
|
145
|
+
const {
|
|
146
|
+
choices
|
|
147
|
+
} = model;
|
|
148
|
+
let {
|
|
149
|
+
maxLengthPerChoice
|
|
150
|
+
} = model;
|
|
151
|
+
const newValLength = (0, _markupUtils.decodeHTML)(newVal || '').length;
|
|
197
152
|
if (!choices[index]) {
|
|
198
153
|
choices[index] = [{
|
|
199
154
|
label: newVal || '',
|
|
200
155
|
value: '0'
|
|
201
|
-
}];
|
|
156
|
+
}];
|
|
202
157
|
|
|
203
|
-
|
|
204
|
-
|
|
158
|
+
// add default values for missing choices up to the new index position
|
|
159
|
+
const nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
|
|
160
|
+
maxLengthPerChoice = [...maxLengthPerChoice, ...Array(nbOfMissingChoices).fill(1)];
|
|
205
161
|
maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
|
|
206
162
|
} else {
|
|
207
163
|
choices[index][0].label = newVal || '';
|
|
208
|
-
|
|
209
164
|
if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
|
|
210
165
|
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
|
|
211
166
|
}
|
|
212
167
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
choices
|
|
216
|
-
maxLengthPerChoice
|
|
217
|
-
})
|
|
168
|
+
onModelChanged({
|
|
169
|
+
...model,
|
|
170
|
+
choices,
|
|
171
|
+
maxLengthPerChoice
|
|
172
|
+
});
|
|
218
173
|
});
|
|
219
|
-
(0, _defineProperty2
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
choices
|
|
223
|
-
maxLengthPerChoice
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
174
|
+
(0, _defineProperty2.default)(this, "onChange", markup => {
|
|
175
|
+
const {
|
|
176
|
+
model: {
|
|
177
|
+
choices,
|
|
178
|
+
maxLengthPerChoice
|
|
179
|
+
},
|
|
180
|
+
onModelChanged
|
|
181
|
+
} = this.props;
|
|
182
|
+
const domMarkup = createElementFromHTML(markup);
|
|
183
|
+
const allRespAreas = domMarkup.querySelectorAll('[data-type="explicit_constructed_response"]');
|
|
184
|
+
const allChoices = {};
|
|
185
|
+
const updatedMaxLengthPerChoice = [];
|
|
186
|
+
allRespAreas.forEach((el, index) => {
|
|
187
|
+
const newChoices = (0, _cloneDeep.default)(choices[el.dataset.index]);
|
|
232
188
|
if (newChoices) {
|
|
233
189
|
newChoices[0] = {
|
|
234
190
|
label: el.dataset.value || '',
|
|
@@ -236,396 +192,324 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
236
192
|
};
|
|
237
193
|
updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];
|
|
238
194
|
}
|
|
239
|
-
|
|
240
195
|
allChoices[index] = newChoices;
|
|
241
196
|
el.dataset.index = index;
|
|
242
197
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
_this.setState({
|
|
198
|
+
const callback = () => onModelChanged({
|
|
199
|
+
...this.props.model,
|
|
200
|
+
choices: allChoices,
|
|
201
|
+
slateMarkup: domMarkup.innerHTML,
|
|
202
|
+
maxLengthPerChoice: updatedMaxLengthPerChoice
|
|
203
|
+
});
|
|
204
|
+
this.setState({
|
|
253
205
|
cachedChoices: undefined
|
|
254
206
|
}, callback);
|
|
255
207
|
});
|
|
256
|
-
(0, _defineProperty2
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
208
|
+
(0, _defineProperty2.default)(this, "onHandleAreaChange", (0, _throttle.default)(nodes => {
|
|
209
|
+
const {
|
|
210
|
+
model: {
|
|
211
|
+
choices
|
|
212
|
+
},
|
|
213
|
+
onModelChanged
|
|
214
|
+
} = this.props;
|
|
215
|
+
const {
|
|
216
|
+
cachedChoices
|
|
217
|
+
} = this.state;
|
|
262
218
|
if (!nodes) {
|
|
263
219
|
return;
|
|
264
220
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
var keyForNode = node.data.get('index');
|
|
270
|
-
|
|
221
|
+
const newChoices = choices ? (0, _cloneDeep.default)(choices) : {};
|
|
222
|
+
const newCachedChoices = cachedChoices ? (0, _cloneDeep.default)(cachedChoices) : {};
|
|
223
|
+
nodes.forEach(node => {
|
|
224
|
+
const keyForNode = node.data.get('index');
|
|
271
225
|
if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {
|
|
272
|
-
Object.assign(newChoices, (0, _pick
|
|
273
|
-
|
|
274
|
-
if (newCachedChoices.hasOwnProperty(keyForNode)) {
|
|
226
|
+
Object.assign(newChoices, (0, _pick.default)(newCachedChoices, keyForNode));
|
|
227
|
+
if (Object.prototype.hasOwnProperty.call(newCachedChoices, keyForNode)) {
|
|
275
228
|
delete newCachedChoices[keyForNode];
|
|
276
229
|
}
|
|
277
230
|
} else {
|
|
278
|
-
Object.assign(newCachedChoices, (0, _pick
|
|
279
|
-
|
|
280
|
-
if (newChoices.hasOwnProperty(keyForNode)) {
|
|
231
|
+
Object.assign(newCachedChoices, (0, _pick.default)(newChoices, keyForNode));
|
|
232
|
+
if (Object.prototype.hasOwnProperty.call(newChoices, keyForNode)) {
|
|
281
233
|
delete newChoices[keyForNode];
|
|
282
234
|
}
|
|
283
235
|
}
|
|
284
236
|
});
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
_this.setState({
|
|
237
|
+
const callback = () => onModelChanged({
|
|
238
|
+
...this.props.model,
|
|
239
|
+
choices: newChoices
|
|
240
|
+
});
|
|
241
|
+
this.setState({
|
|
293
242
|
cachedChoices: newCachedChoices
|
|
294
243
|
}, callback);
|
|
295
244
|
}, 500, {
|
|
296
245
|
trailing: false,
|
|
297
246
|
leading: true
|
|
298
247
|
}));
|
|
299
|
-
return _this;
|
|
300
248
|
}
|
|
249
|
+
componentDidMount() {
|
|
250
|
+
const {
|
|
251
|
+
model: {
|
|
252
|
+
slateMarkup,
|
|
253
|
+
choices,
|
|
254
|
+
maxLengthPerChoice = []
|
|
255
|
+
},
|
|
256
|
+
onModelChanged
|
|
257
|
+
} = this.props;
|
|
258
|
+
const undefinedLengths = !maxLengthPerChoice.length;
|
|
259
|
+
this.setState({
|
|
260
|
+
markup: slateMarkup
|
|
261
|
+
});
|
|
301
262
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
responseAreasError = _ref3.responseAreas,
|
|
402
|
-
teacherInstructionsError = _ref3.teacherInstructions;
|
|
403
|
-
|
|
404
|
-
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
405
|
-
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
406
|
-
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
407
|
-
var toolbarOpts = {
|
|
408
|
-
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
409
|
-
};
|
|
410
|
-
var panelSettings = {
|
|
411
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
412
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),
|
|
413
|
-
'language.enabled': language.settings && toggle(language.label, true),
|
|
414
|
-
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
415
|
-
'responseAreaInputConfiguration.inputConfiguration.characters.disabled': spanishButton.settings && toggle(spanishButton.label, true)
|
|
416
|
-
};
|
|
417
|
-
var panelProperties = {
|
|
418
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
419
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
420
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
421
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
422
|
-
playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),
|
|
423
|
-
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label),
|
|
424
|
-
'editSource.enabled': (editSource === null || editSource === void 0 ? void 0 : editSource.settings) && toggle(editSource.label, true)
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
var getPluginProps = function getPluginProps() {
|
|
428
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
429
|
-
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
433
|
-
extraCSSRules: extraCSSRules,
|
|
434
|
-
dimensions: contentDimensions,
|
|
435
|
-
hideSettings: settingsPanelDisabled,
|
|
436
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
437
|
-
model: model,
|
|
438
|
-
configuration: configuration,
|
|
439
|
-
onChangeModel: function onChangeModel(model) {
|
|
440
|
-
return _this2.onModelChange(model);
|
|
441
|
-
},
|
|
442
|
-
onChangeConfiguration: function onChangeConfiguration(configuration) {
|
|
443
|
-
return onConfigurationChanged(configuration, true);
|
|
444
|
-
},
|
|
445
|
-
groups: {
|
|
446
|
-
Settings: panelSettings,
|
|
447
|
-
Properties: panelProperties
|
|
448
|
-
}
|
|
449
|
-
})
|
|
450
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
451
|
-
label: teacherInstructions.label,
|
|
452
|
-
className: classes.promptHolder
|
|
453
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
454
|
-
className: classes.prompt,
|
|
455
|
-
markup: model.teacherInstructions || '',
|
|
456
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
457
|
-
imageSupport: imageSupport,
|
|
458
|
-
nonEmpty: false,
|
|
459
|
-
error: teacherInstructionsError,
|
|
460
|
-
toolbarOpts: toolbarOpts,
|
|
461
|
-
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
|
|
462
|
-
spellCheck: spellCheckEnabled,
|
|
463
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
464
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
465
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
466
|
-
languageCharactersProps: [{
|
|
467
|
-
language: 'spanish'
|
|
468
|
-
}, {
|
|
469
|
-
language: 'special'
|
|
470
|
-
}],
|
|
471
|
-
mathMlOptions: mathMlOptions,
|
|
472
|
-
autoWidthToolbar: true
|
|
473
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
474
|
-
className: classes.errorText
|
|
475
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
476
|
-
label: prompt.label,
|
|
477
|
-
className: classes.promptHolder
|
|
478
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
479
|
-
className: classes.prompt,
|
|
480
|
-
markup: model.prompt,
|
|
481
|
-
onChange: this.onPromptChanged,
|
|
482
|
-
imageSupport: imageSupport,
|
|
483
|
-
nonEmpty: false,
|
|
484
|
-
disableUnderline: true,
|
|
485
|
-
error: promptError,
|
|
486
|
-
toolbarOpts: toolbarOpts,
|
|
487
|
-
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
|
|
488
|
-
spellCheck: spellCheckEnabled,
|
|
489
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
490
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
491
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
492
|
-
languageCharactersProps: [{
|
|
493
|
-
language: 'spanish'
|
|
494
|
-
}, {
|
|
495
|
-
language: 'special'
|
|
496
|
-
}],
|
|
497
|
-
mathMlOptions: mathMlOptions,
|
|
498
|
-
autoWidthToolbar: true
|
|
499
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
500
|
-
className: classes.errorText
|
|
501
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
502
|
-
className: classes.flexContainer
|
|
503
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
504
|
-
className: classes.text,
|
|
505
|
-
component: "div"
|
|
506
|
-
}, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
507
|
-
classes: {
|
|
508
|
-
tooltip: classes.tooltip
|
|
509
|
-
},
|
|
510
|
-
disableFocusListener: true,
|
|
511
|
-
disableTouchListener: true,
|
|
512
|
-
placement: 'right',
|
|
513
|
-
title: validationMessage
|
|
514
|
-
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
515
|
-
fontSize: 'small',
|
|
516
|
-
color: 'primary',
|
|
517
|
-
style: {
|
|
518
|
-
marginLeft: '8px'
|
|
263
|
+
// calculate maxLengthPerChoice array if it is not defined or defined incorrectly
|
|
264
|
+
Object.values(choices).forEach((choice, index) => {
|
|
265
|
+
const labelLengthsArr = choice.map(choice => (0, _markupUtils.decodeHTML)(choice.label || '').length);
|
|
266
|
+
const length = Math.max(...labelLengthsArr);
|
|
267
|
+
if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length || maxLengthPerChoice[index] > length + 10) {
|
|
268
|
+
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(length);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
onModelChanged({
|
|
272
|
+
...this.props.model,
|
|
273
|
+
maxLengthPerChoice
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
render() {
|
|
277
|
+
const {
|
|
278
|
+
model,
|
|
279
|
+
configuration,
|
|
280
|
+
onConfigurationChanged,
|
|
281
|
+
imageSupport,
|
|
282
|
+
uploadSoundSupport
|
|
283
|
+
} = this.props;
|
|
284
|
+
const {
|
|
285
|
+
baseInputConfiguration = {},
|
|
286
|
+
contentDimensions = {},
|
|
287
|
+
maxImageWidth = {},
|
|
288
|
+
maxImageHeight = {},
|
|
289
|
+
maxLengthPerChoice = {},
|
|
290
|
+
maxResponseAreas,
|
|
291
|
+
partialScoring = {},
|
|
292
|
+
playerSpellCheck = {},
|
|
293
|
+
prompt = {},
|
|
294
|
+
rationale = {},
|
|
295
|
+
template = {},
|
|
296
|
+
settingsPanelDisabled,
|
|
297
|
+
spellCheck = {},
|
|
298
|
+
editSource = {},
|
|
299
|
+
teacherInstructions = {},
|
|
300
|
+
withRubric = {},
|
|
301
|
+
mathMlOptions = {},
|
|
302
|
+
language = {},
|
|
303
|
+
languageChoices = {},
|
|
304
|
+
spanishButton = {},
|
|
305
|
+
responseAreaInputConfiguration = {}
|
|
306
|
+
} = configuration || {};
|
|
307
|
+
const {
|
|
308
|
+
errors,
|
|
309
|
+
extraCSSRules,
|
|
310
|
+
maxLengthPerChoiceEnabled,
|
|
311
|
+
promptEnabled,
|
|
312
|
+
rationaleEnabled,
|
|
313
|
+
spellCheckEnabled,
|
|
314
|
+
teacherInstructionsEnabled,
|
|
315
|
+
toolbarEditorPosition
|
|
316
|
+
} = model || {};
|
|
317
|
+
const {
|
|
318
|
+
choices: choicesErrors = {},
|
|
319
|
+
prompt: promptError,
|
|
320
|
+
rationale: rationaleError,
|
|
321
|
+
responseAreas: responseAreasError,
|
|
322
|
+
teacherInstructions: teacherInstructionsError
|
|
323
|
+
} = errors || {};
|
|
324
|
+
const validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
325
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
326
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
327
|
+
const toolbarOpts = {
|
|
328
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
329
|
+
};
|
|
330
|
+
const panelSettings = {
|
|
331
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
332
|
+
maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),
|
|
333
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
334
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
335
|
+
'responseAreaInputConfiguration.inputConfiguration.characters.disabled': spanishButton.settings && toggle(spanishButton.label, true)
|
|
336
|
+
};
|
|
337
|
+
const panelProperties = {
|
|
338
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
339
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
340
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
341
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
342
|
+
playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),
|
|
343
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
|
|
344
|
+
'editSource.enabled': editSource?.settings && toggle(editSource.label, true)
|
|
345
|
+
};
|
|
346
|
+
const getPluginProps = (props = {}) => ({
|
|
347
|
+
...baseInputConfiguration,
|
|
348
|
+
...props
|
|
349
|
+
});
|
|
350
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
351
|
+
extraCSSRules: extraCSSRules,
|
|
352
|
+
dimensions: contentDimensions,
|
|
353
|
+
hideSettings: settingsPanelDisabled,
|
|
354
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
355
|
+
model: model,
|
|
356
|
+
configuration: configuration,
|
|
357
|
+
onChangeModel: model => this.onModelChange(model),
|
|
358
|
+
onChangeConfiguration: configuration => onConfigurationChanged(configuration, true),
|
|
359
|
+
groups: {
|
|
360
|
+
Settings: panelSettings,
|
|
361
|
+
Properties: panelProperties
|
|
519
362
|
}
|
|
520
|
-
})
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
363
|
+
})
|
|
364
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
365
|
+
label: teacherInstructions.label
|
|
366
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
367
|
+
className: "prompt",
|
|
368
|
+
markup: model.teacherInstructions || '',
|
|
369
|
+
onChange: this.onTeacherInstructionsChanged,
|
|
370
|
+
imageSupport: imageSupport,
|
|
371
|
+
nonEmpty: false,
|
|
372
|
+
error: teacherInstructionsError,
|
|
373
|
+
toolbarOpts: toolbarOpts,
|
|
374
|
+
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
|
|
375
|
+
spellCheck: spellCheckEnabled,
|
|
376
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
377
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
378
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
379
|
+
languageCharactersProps: [{
|
|
380
|
+
language: 'spanish'
|
|
381
|
+
}, {
|
|
382
|
+
language: 'special'
|
|
383
|
+
}],
|
|
384
|
+
mathMlOptions: mathMlOptions,
|
|
385
|
+
autoWidthToolbar: true
|
|
386
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
387
|
+
label: prompt.label
|
|
388
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
389
|
+
className: "prompt",
|
|
390
|
+
markup: model.prompt,
|
|
391
|
+
onChange: this.onPromptChanged,
|
|
392
|
+
imageSupport: imageSupport,
|
|
393
|
+
nonEmpty: false,
|
|
394
|
+
disableUnderline: true,
|
|
395
|
+
error: promptError,
|
|
396
|
+
toolbarOpts: toolbarOpts,
|
|
397
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
398
|
+
spellCheck: spellCheckEnabled,
|
|
399
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
400
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
401
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
402
|
+
languageCharactersProps: [{
|
|
403
|
+
language: 'spanish'
|
|
404
|
+
}, {
|
|
405
|
+
language: 'special'
|
|
406
|
+
}],
|
|
407
|
+
mathMlOptions: mathMlOptions,
|
|
408
|
+
autoWidthToolbar: true
|
|
409
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(FlexContainer, null, /*#__PURE__*/_react.default.createElement(StyledText, {
|
|
410
|
+
component: "div"
|
|
411
|
+
}, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react.default.createElement(StyledTooltip, {
|
|
412
|
+
disableFocusListener: true,
|
|
413
|
+
disableTouchListener: true,
|
|
414
|
+
placement: 'right',
|
|
415
|
+
title: validationMessage
|
|
416
|
+
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
417
|
+
fontSize: 'small',
|
|
418
|
+
color: 'primary',
|
|
419
|
+
style: {
|
|
420
|
+
marginLeft: '8px'
|
|
421
|
+
}
|
|
422
|
+
}))), /*#__PURE__*/_react.default.createElement(MarkupContainer, {
|
|
423
|
+
activePlugins: _editableHtml.ALL_PLUGINS,
|
|
424
|
+
toolbarOpts: {
|
|
425
|
+
position: 'top'
|
|
426
|
+
},
|
|
427
|
+
spellCheck: spellCheckEnabled,
|
|
428
|
+
pluginProps: getPluginProps(template?.inputConfiguration),
|
|
429
|
+
responseAreaProps: {
|
|
430
|
+
type: 'explicit-constructed-response',
|
|
431
|
+
options: {
|
|
432
|
+
duplicates: true
|
|
524
433
|
},
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
},
|
|
541
|
-
node: node,
|
|
542
|
-
value: value,
|
|
543
|
-
onToolbarDone: onToolbarDone,
|
|
544
|
-
correctChoice: correctChoice,
|
|
545
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
|
|
546
|
-
pluginProps: getPluginProps(responseAreaInputConfiguration === null || responseAreaInputConfiguration === void 0 ? void 0 : responseAreaInputConfiguration.inputConfiguration)
|
|
547
|
-
});
|
|
548
|
-
};
|
|
549
|
-
},
|
|
550
|
-
error: function error() {
|
|
551
|
-
return choicesErrors;
|
|
552
|
-
},
|
|
553
|
-
onHandleAreaChange: this.onHandleAreaChange
|
|
434
|
+
maxResponseAreas: maxResponseAreas,
|
|
435
|
+
respAreaToolbar: (node, value, onToolbarDone) => {
|
|
436
|
+
const {
|
|
437
|
+
model
|
|
438
|
+
} = this.props;
|
|
439
|
+
const correctChoice = (model.choices[node.data.get('index')] || [])[0];
|
|
440
|
+
return () => /*#__PURE__*/_react.default.createElement(_ecrToolbar.default, {
|
|
441
|
+
onChangeResponse: newVal => this.onChangeResponse(node.data.get('index'), newVal),
|
|
442
|
+
node: node,
|
|
443
|
+
value: value,
|
|
444
|
+
onToolbarDone: onToolbarDone,
|
|
445
|
+
correctChoice: correctChoice,
|
|
446
|
+
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
|
|
447
|
+
pluginProps: getPluginProps(responseAreaInputConfiguration?.inputConfiguration)
|
|
448
|
+
});
|
|
554
449
|
},
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
607
|
-
className: classes.errorText
|
|
608
|
-
}, rationaleError)));
|
|
609
|
-
}
|
|
610
|
-
}]);
|
|
611
|
-
return Main;
|
|
612
|
-
}(_react["default"].Component);
|
|
613
|
-
|
|
450
|
+
error: () => choicesErrors,
|
|
451
|
+
onHandleAreaChange: this.onHandleAreaChange
|
|
452
|
+
},
|
|
453
|
+
markup: model.slateMarkup,
|
|
454
|
+
onChange: this.onChange,
|
|
455
|
+
imageSupport: imageSupport,
|
|
456
|
+
disableImageAlignmentButtons: true,
|
|
457
|
+
onBlur: this.onBlur,
|
|
458
|
+
disabled: false,
|
|
459
|
+
highlightShape: false,
|
|
460
|
+
error: responseAreasError,
|
|
461
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
462
|
+
languageCharactersProps: [{
|
|
463
|
+
language: 'spanish'
|
|
464
|
+
}, {
|
|
465
|
+
language: 'special'
|
|
466
|
+
}],
|
|
467
|
+
mathMlOptions: mathMlOptions,
|
|
468
|
+
autoWidthToolbar: true
|
|
469
|
+
}), responseAreasError && /*#__PURE__*/_react.default.createElement(ErrorText, null, responseAreasError), !(0, _isEmpty.default)(model.choices) && /*#__PURE__*/_react.default.createElement(ResponseHeader, null, `Define Alternates ${maxLengthPerChoiceEnabled ? 'and Character Limits' : ''}`), /*#__PURE__*/_react.default.createElement(_alternateResponses.default, {
|
|
470
|
+
model: model,
|
|
471
|
+
onChange: this.onResponsesChanged,
|
|
472
|
+
onLengthChange: this.onLengthChanged,
|
|
473
|
+
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
|
|
474
|
+
spellCheck: spellCheckEnabled,
|
|
475
|
+
choicesErrors: choicesErrors,
|
|
476
|
+
pluginProps: getPluginProps(responseAreaInputConfiguration?.inputConfiguration)
|
|
477
|
+
}), rationaleEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
478
|
+
label: rationale.label
|
|
479
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
480
|
+
className: "prompt",
|
|
481
|
+
markup: model.rationale || '',
|
|
482
|
+
onChange: this.onRationaleChanged,
|
|
483
|
+
imageSupport: imageSupport,
|
|
484
|
+
error: rationaleError,
|
|
485
|
+
toolbarOpts: toolbarOpts,
|
|
486
|
+
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
487
|
+
spellCheck: spellCheckEnabled,
|
|
488
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
489
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
490
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
491
|
+
languageCharactersProps: [{
|
|
492
|
+
language: 'spanish'
|
|
493
|
+
}, {
|
|
494
|
+
language: 'special'
|
|
495
|
+
}],
|
|
496
|
+
mathMlOptions: mathMlOptions,
|
|
497
|
+
autoWidthToolbar: true
|
|
498
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
614
501
|
exports.Main = Main;
|
|
615
|
-
(0, _defineProperty2
|
|
616
|
-
configuration: _propTypes
|
|
617
|
-
model: _propTypes
|
|
618
|
-
disableSidePanel: _propTypes
|
|
619
|
-
onModelChanged: _propTypes
|
|
620
|
-
onConfigurationChanged: _propTypes
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
"delete": _propTypes["default"].func.isRequired
|
|
502
|
+
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
503
|
+
configuration: _propTypes.default.object.isRequired,
|
|
504
|
+
model: _propTypes.default.object.isRequired,
|
|
505
|
+
disableSidePanel: _propTypes.default.bool,
|
|
506
|
+
onModelChanged: _propTypes.default.func.isRequired,
|
|
507
|
+
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
508
|
+
imageSupport: _propTypes.default.shape({
|
|
509
|
+
add: _propTypes.default.func.isRequired,
|
|
510
|
+
delete: _propTypes.default.func.isRequired
|
|
625
511
|
}),
|
|
626
|
-
uploadSoundSupport: _propTypes
|
|
512
|
+
uploadSoundSupport: _propTypes.default.object
|
|
627
513
|
});
|
|
628
|
-
var
|
|
629
|
-
var _default = Styled;
|
|
630
|
-
exports["default"] = _default;
|
|
514
|
+
var _default = exports.default = Main;
|
|
631
515
|
//# sourceMappingURL=main.js.map
|