@pie-element/explicit-constructed-response 3.12.0 → 3.12.1-beta.1443
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 +350 -0
- package/configure/CHANGELOG.md +330 -0
- package/configure/lib/alternateResponses.js +13 -7
- package/configure/lib/alternateResponses.js.map +1 -1
- package/configure/lib/alternateSection.js +39 -17
- package/configure/lib/alternateSection.js.map +1 -1
- package/configure/lib/defaults.js +28 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/ecr-toolbar.js +15 -6
- package/configure/lib/ecr-toolbar.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +234 -74
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +9 -3
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +15 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +23 -5
- package/controller/CHANGELOG.md +40 -0
- package/controller/lib/index.js +64 -6
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +121 -0
- package/docs/config-schema.json.md +93 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +4 -3
- package/docs/pie-schema.json +39 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/main.js +6 -3
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -1953
- package/module/controller.js +0 -21340
- package/module/demo.js +0 -45
- package/module/element.js +0 -14384
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -14331
package/configure/lib/main.js
CHANGED
|
@@ -33,6 +33,10 @@ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
|
33
33
|
|
|
34
34
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
35
35
|
|
|
36
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
37
|
+
|
|
38
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
39
|
+
|
|
36
40
|
var _editableHtml = _interopRequireWildcard(require("@pie-lib/editable-html"));
|
|
37
41
|
|
|
38
42
|
var _configUi = require("@pie-lib/config-ui");
|
|
@@ -41,19 +45,25 @@ var _styles = require("@material-ui/core/styles");
|
|
|
41
45
|
|
|
42
46
|
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
43
47
|
|
|
48
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
49
|
+
|
|
50
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
51
|
+
|
|
44
52
|
var _ecrToolbar = _interopRequireDefault(require("./ecr-toolbar"));
|
|
45
53
|
|
|
46
54
|
var _alternateResponses = _interopRequireDefault(require("./alternateResponses"));
|
|
47
55
|
|
|
48
56
|
var _markupUtils = require("./markupUtils");
|
|
49
57
|
|
|
58
|
+
var _utils = require("./utils");
|
|
59
|
+
|
|
50
60
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
61
|
|
|
52
62
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
63
|
|
|
54
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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; }
|
|
55
65
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
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; }
|
|
57
67
|
|
|
58
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); }; }
|
|
59
69
|
|
|
@@ -98,9 +108,23 @@ var styles = function styles(theme) {
|
|
|
98
108
|
text: {
|
|
99
109
|
color: '#495B8F',
|
|
100
110
|
fontFamily: 'Cerebri Sans',
|
|
101
|
-
fontSize:
|
|
111
|
+
fontSize: theme.typography.fontSize + 2,
|
|
102
112
|
lineHeight: '19px',
|
|
103
113
|
marginTop: theme.spacing.unit * 4
|
|
114
|
+
},
|
|
115
|
+
tooltip: {
|
|
116
|
+
fontSize: theme.typography.fontSize - 2,
|
|
117
|
+
whiteSpace: 'pre',
|
|
118
|
+
maxWidth: '500px'
|
|
119
|
+
},
|
|
120
|
+
errorText: {
|
|
121
|
+
fontSize: theme.typography.fontSize - 2,
|
|
122
|
+
color: 'red',
|
|
123
|
+
paddingTop: theme.spacing.unit
|
|
124
|
+
},
|
|
125
|
+
flexContainer: {
|
|
126
|
+
display: 'flex',
|
|
127
|
+
alignItems: 'end'
|
|
104
128
|
}
|
|
105
129
|
};
|
|
106
130
|
};
|
|
@@ -170,22 +194,25 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
170
194
|
var _this$props3 = _this.props,
|
|
171
195
|
model = _this$props3.model,
|
|
172
196
|
onModelChanged = _this$props3.onModelChanged;
|
|
173
|
-
var choices = model.choices
|
|
174
|
-
|
|
175
|
-
var newValLength = (
|
|
197
|
+
var choices = model.choices;
|
|
198
|
+
var maxLengthPerChoice = model.maxLengthPerChoice;
|
|
199
|
+
var newValLength = (newVal || '').length;
|
|
176
200
|
|
|
177
201
|
if (!choices[index]) {
|
|
178
202
|
choices[index] = [{
|
|
179
|
-
label: '',
|
|
203
|
+
label: newVal || '',
|
|
180
204
|
value: '0'
|
|
181
|
-
}];
|
|
182
|
-
maxLengthPerChoice.splice(index, 0, newValLength);
|
|
183
|
-
}
|
|
205
|
+
}]; // add default values for missing choices up to the new index position
|
|
184
206
|
|
|
185
|
-
|
|
207
|
+
var nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
|
|
208
|
+
maxLengthPerChoice = [].concat((0, _toConsumableArray2["default"])(maxLengthPerChoice), (0, _toConsumableArray2["default"])(Array(nbOfMissingChoices).fill(1)));
|
|
209
|
+
maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
|
|
210
|
+
} else {
|
|
211
|
+
choices[index][0].label = newVal || '';
|
|
186
212
|
|
|
187
|
-
|
|
188
|
-
|
|
213
|
+
if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
|
|
214
|
+
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
|
|
215
|
+
}
|
|
189
216
|
}
|
|
190
217
|
|
|
191
218
|
onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
@@ -194,9 +221,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
194
221
|
}));
|
|
195
222
|
});
|
|
196
223
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (markup) {
|
|
197
|
-
var _this$
|
|
198
|
-
|
|
199
|
-
|
|
224
|
+
var _this$props4 = _this.props,
|
|
225
|
+
_this$props4$model = _this$props4.model,
|
|
226
|
+
choices = _this$props4$model.choices,
|
|
227
|
+
maxLengthPerChoice = _this$props4$model.maxLengthPerChoice,
|
|
228
|
+
onModelChanged = _this$props4.onModelChanged;
|
|
200
229
|
var domMarkup = createElementFromHTML(markup);
|
|
201
230
|
var allRespAreas = domMarkup.querySelectorAll('[data-type="explicit_constructed_response"]');
|
|
202
231
|
var allChoices = {};
|
|
@@ -216,25 +245,74 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
216
245
|
el.dataset.index = index;
|
|
217
246
|
});
|
|
218
247
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
248
|
+
var callback = function callback() {
|
|
249
|
+
return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
250
|
+
choices: allChoices,
|
|
251
|
+
slateMarkup: domMarkup.innerHTML,
|
|
252
|
+
maxLengthPerChoice: updatedMaxLengthPerChoice
|
|
253
|
+
}));
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
_this.setState({
|
|
257
|
+
cachedChoices: undefined
|
|
258
|
+
}, callback);
|
|
224
259
|
});
|
|
260
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onHandleAreaChange", (0, _throttle["default"])(function (nodes) {
|
|
261
|
+
var _this$props5 = _this.props,
|
|
262
|
+
choices = _this$props5.model.choices,
|
|
263
|
+
onModelChanged = _this$props5.onModelChanged;
|
|
264
|
+
var cachedChoices = _this.state.cachedChoices;
|
|
265
|
+
|
|
266
|
+
if (!nodes) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
var newChoices = choices ? (0, _cloneDeep["default"])(choices) : {};
|
|
271
|
+
var newCachedChoices = cachedChoices ? (0, _cloneDeep["default"])(cachedChoices) : {};
|
|
272
|
+
nodes.forEach(function (node) {
|
|
273
|
+
var keyForNode = node.data.get('index');
|
|
274
|
+
|
|
275
|
+
if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {
|
|
276
|
+
Object.assign(newChoices, (0, _pick["default"])(newCachedChoices, keyForNode));
|
|
277
|
+
|
|
278
|
+
if (newCachedChoices.hasOwnProperty(keyForNode)) {
|
|
279
|
+
delete newCachedChoices[keyForNode];
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
Object.assign(newCachedChoices, (0, _pick["default"])(newChoices, keyForNode));
|
|
283
|
+
|
|
284
|
+
if (newChoices.hasOwnProperty(keyForNode)) {
|
|
285
|
+
delete newChoices[keyForNode];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
var callback = function callback() {
|
|
291
|
+
return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
292
|
+
choices: newChoices
|
|
293
|
+
}));
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
_this.setState({
|
|
297
|
+
cachedChoices: newCachedChoices
|
|
298
|
+
}, callback);
|
|
299
|
+
}, 500, {
|
|
300
|
+
trailing: false,
|
|
301
|
+
leading: true
|
|
302
|
+
}));
|
|
225
303
|
return _this;
|
|
226
304
|
}
|
|
227
305
|
|
|
228
306
|
(0, _createClass2["default"])(Main, [{
|
|
229
307
|
key: "componentDidMount",
|
|
230
308
|
value: function componentDidMount() {
|
|
231
|
-
var _this$
|
|
232
|
-
_this$
|
|
233
|
-
slateMarkup = _this$
|
|
234
|
-
choices = _this$
|
|
235
|
-
_this$
|
|
236
|
-
maxLengthPerChoice = _this$
|
|
237
|
-
onModelChanged = _this$
|
|
309
|
+
var _this$props6 = this.props,
|
|
310
|
+
_this$props6$model = _this$props6.model,
|
|
311
|
+
slateMarkup = _this$props6$model.slateMarkup,
|
|
312
|
+
choices = _this$props6$model.choices,
|
|
313
|
+
_this$props6$model$ma = _this$props6$model.maxLengthPerChoice,
|
|
314
|
+
maxLengthPerChoice = _this$props6$model$ma === void 0 ? [] : _this$props6$model$ma,
|
|
315
|
+
onModelChanged = _this$props6.onModelChanged;
|
|
238
316
|
var undefinedLengths = !maxLengthPerChoice.length;
|
|
239
317
|
this.setState({
|
|
240
318
|
markup: slateMarkup
|
|
@@ -244,10 +322,10 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
244
322
|
var labelLengthsArr = (choice || []).map(function (choice) {
|
|
245
323
|
return (choice.label || '').length;
|
|
246
324
|
});
|
|
247
|
-
var length =
|
|
325
|
+
var length = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
248
326
|
|
|
249
|
-
if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length) {
|
|
250
|
-
maxLengthPerChoice[index] = length;
|
|
327
|
+
if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length || maxLengthPerChoice[index] > length + 10) {
|
|
328
|
+
maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(length);
|
|
251
329
|
}
|
|
252
330
|
});
|
|
253
331
|
onModelChanged(_objectSpread(_objectSpread({}, this.props.model), {}, {
|
|
@@ -259,46 +337,74 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
259
337
|
value: function render() {
|
|
260
338
|
var _this2 = this;
|
|
261
339
|
|
|
262
|
-
var _this$
|
|
263
|
-
classes = _this$
|
|
264
|
-
model = _this$
|
|
265
|
-
configuration = _this$
|
|
266
|
-
onConfigurationChanged = _this$
|
|
267
|
-
imageSupport = _this$
|
|
340
|
+
var _this$props7 = this.props,
|
|
341
|
+
classes = _this$props7.classes,
|
|
342
|
+
model = _this$props7.model,
|
|
343
|
+
configuration = _this$props7.configuration,
|
|
344
|
+
onConfigurationChanged = _this$props7.onConfigurationChanged,
|
|
345
|
+
imageSupport = _this$props7.imageSupport,
|
|
346
|
+
uploadSoundSupport = _this$props7.uploadSoundSupport;
|
|
268
347
|
|
|
269
348
|
var _ref = configuration || {},
|
|
270
|
-
_ref$
|
|
271
|
-
|
|
349
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
350
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
351
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
352
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight,
|
|
353
|
+
_ref$maxLengthPerChoi = _ref.maxLengthPerChoice,
|
|
354
|
+
maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi,
|
|
355
|
+
maxResponseAreas = _ref.maxResponseAreas,
|
|
272
356
|
_ref$partialScoring = _ref.partialScoring,
|
|
273
357
|
partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring,
|
|
358
|
+
_ref$playerSpellCheck = _ref.playerSpellCheck,
|
|
359
|
+
playerSpellCheck = _ref$playerSpellCheck === void 0 ? {} : _ref$playerSpellCheck,
|
|
360
|
+
_ref$prompt = _ref.prompt,
|
|
361
|
+
prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
274
362
|
_ref$rationale = _ref.rationale,
|
|
275
363
|
rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
|
|
364
|
+
settingsPanelDisabled = _ref.settingsPanelDisabled,
|
|
365
|
+
_ref$spellCheck = _ref.spellCheck,
|
|
366
|
+
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
276
367
|
_ref$teacherInstructi = _ref.teacherInstructions,
|
|
277
368
|
teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
|
|
278
|
-
_ref$
|
|
279
|
-
|
|
369
|
+
_ref$withRubric = _ref.withRubric,
|
|
370
|
+
withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric;
|
|
280
371
|
|
|
281
372
|
var _ref2 = model || {},
|
|
282
|
-
|
|
373
|
+
errors = _ref2.errors,
|
|
374
|
+
maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled,
|
|
283
375
|
promptEnabled = _ref2.promptEnabled,
|
|
284
376
|
rationaleEnabled = _ref2.rationaleEnabled,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
377
|
+
spellCheckEnabled = _ref2.spellCheckEnabled,
|
|
378
|
+
teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
|
|
379
|
+
toolbarEditorPosition = _ref2.toolbarEditorPosition;
|
|
380
|
+
|
|
381
|
+
var _ref3 = errors || {},
|
|
382
|
+
_ref3$choicesErrors = _ref3.choicesErrors,
|
|
383
|
+
choicesErrors = _ref3$choicesErrors === void 0 ? {} : _ref3$choicesErrors,
|
|
384
|
+
responseAreasError = _ref3.responseAreasError;
|
|
385
|
+
|
|
386
|
+
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
387
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
388
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
389
|
+
var toolbarOpts = {
|
|
390
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
391
|
+
};
|
|
392
|
+
var panelSettings = {
|
|
393
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
394
|
+
maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label)
|
|
395
|
+
};
|
|
396
|
+
var panelProperties = {
|
|
397
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
398
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
399
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
400
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
401
|
+
playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),
|
|
402
|
+
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
403
|
+
};
|
|
299
404
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
300
405
|
className: classes.design
|
|
301
406
|
}, /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
407
|
+
hideSettings: settingsPanelDisabled,
|
|
302
408
|
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
303
409
|
model: model,
|
|
304
410
|
configuration: configuration,
|
|
@@ -309,15 +415,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
309
415
|
return onConfigurationChanged(configuration, true);
|
|
310
416
|
},
|
|
311
417
|
groups: {
|
|
312
|
-
Settings:
|
|
313
|
-
|
|
314
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label)
|
|
315
|
-
},
|
|
316
|
-
Properties: {
|
|
317
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
318
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
319
|
-
promptEnabled: prompt.settings && toggle(prompt.label)
|
|
320
|
-
}
|
|
418
|
+
Settings: panelSettings,
|
|
419
|
+
Properties: panelProperties
|
|
321
420
|
}
|
|
322
421
|
})
|
|
323
422
|
}, /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
@@ -329,7 +428,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
329
428
|
onChange: this.onTeacherInstructionsChanged,
|
|
330
429
|
imageSupport: imageSupport,
|
|
331
430
|
nonEmpty: false,
|
|
332
|
-
toolbarOpts: toolbarOpts
|
|
431
|
+
toolbarOpts: toolbarOpts,
|
|
432
|
+
spellCheck: spellCheckEnabled,
|
|
433
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
434
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
435
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
436
|
+
languageCharactersProps: [{
|
|
437
|
+
language: 'spanish'
|
|
438
|
+
}, {
|
|
439
|
+
language: 'special'
|
|
440
|
+
}]
|
|
333
441
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
334
442
|
label: prompt.label,
|
|
335
443
|
className: classes.promptHolder
|
|
@@ -340,19 +448,46 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
340
448
|
imageSupport: imageSupport,
|
|
341
449
|
nonEmpty: false,
|
|
342
450
|
disableUnderline: true,
|
|
343
|
-
toolbarOpts: toolbarOpts
|
|
344
|
-
|
|
451
|
+
toolbarOpts: toolbarOpts,
|
|
452
|
+
spellCheck: spellCheckEnabled,
|
|
453
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
454
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
455
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
456
|
+
languageCharactersProps: [{
|
|
457
|
+
language: 'spanish'
|
|
458
|
+
}, {
|
|
459
|
+
language: 'special'
|
|
460
|
+
}]
|
|
461
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
462
|
+
className: classes.flexContainer
|
|
463
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
345
464
|
className: classes.text
|
|
346
|
-
}, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(
|
|
465
|
+
}, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
466
|
+
classes: {
|
|
467
|
+
tooltip: classes.tooltip
|
|
468
|
+
},
|
|
469
|
+
disableFocusListener: true,
|
|
470
|
+
disableTouchListener: true,
|
|
471
|
+
placement: 'right',
|
|
472
|
+
title: validationMessage
|
|
473
|
+
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
474
|
+
fontSize: 'small',
|
|
475
|
+
color: 'primary',
|
|
476
|
+
style: {
|
|
477
|
+
marginLeft: '8px'
|
|
478
|
+
}
|
|
479
|
+
}))), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
347
480
|
activePlugins: _editableHtml.ALL_PLUGINS,
|
|
348
481
|
toolbarOpts: {
|
|
349
482
|
position: 'top'
|
|
350
483
|
},
|
|
484
|
+
spellCheck: spellCheckEnabled,
|
|
351
485
|
responseAreaProps: {
|
|
352
486
|
type: 'explicit-constructed-response',
|
|
353
487
|
options: {
|
|
354
488
|
duplicates: true
|
|
355
489
|
},
|
|
490
|
+
maxResponseAreas: maxResponseAreas,
|
|
356
491
|
respAreaToolbar: function respAreaToolbar(node, value, onToolbarDone) {
|
|
357
492
|
var model = _this2.props.model;
|
|
358
493
|
var correctChoice = (model.choices[node.data.get('index')] || [])[0];
|
|
@@ -367,22 +502,38 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
367
502
|
correctChoice: correctChoice
|
|
368
503
|
});
|
|
369
504
|
};
|
|
370
|
-
}
|
|
505
|
+
},
|
|
506
|
+
error: function error() {
|
|
507
|
+
return choicesErrors;
|
|
508
|
+
},
|
|
509
|
+
onHandleAreaChange: this.onHandleAreaChange
|
|
371
510
|
},
|
|
372
511
|
className: classes.markup,
|
|
373
512
|
markup: model.slateMarkup,
|
|
374
513
|
onChange: this.onChange,
|
|
375
514
|
imageSupport: imageSupport,
|
|
515
|
+
disableImageAlignmentButtons: true,
|
|
376
516
|
onBlur: this.onBlur,
|
|
377
517
|
disabled: false,
|
|
378
|
-
highlightShape: false
|
|
379
|
-
|
|
518
|
+
highlightShape: false,
|
|
519
|
+
error: responseAreasError,
|
|
520
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
521
|
+
languageCharactersProps: [{
|
|
522
|
+
language: 'spanish'
|
|
523
|
+
}, {
|
|
524
|
+
language: 'special'
|
|
525
|
+
}]
|
|
526
|
+
}), responseAreasError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
527
|
+
className: classes.errorText
|
|
528
|
+
}, responseAreasError), !(0, _isEmpty["default"])(model.choices) && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
380
529
|
className: classes.text
|
|
381
530
|
}, "Define Alternates ".concat(maxLengthPerChoiceEnabled ? 'and Character Limits' : '')), /*#__PURE__*/_react["default"].createElement(_alternateResponses["default"], {
|
|
382
531
|
model: model,
|
|
383
532
|
onChange: this.onResponsesChanged,
|
|
384
533
|
onLengthChange: this.onLengthChanged,
|
|
385
|
-
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled
|
|
534
|
+
maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
|
|
535
|
+
spellCheck: spellCheckEnabled,
|
|
536
|
+
choicesErrors: choicesErrors
|
|
386
537
|
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
387
538
|
label: rationale.label,
|
|
388
539
|
className: classes.promptHolder
|
|
@@ -391,7 +542,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
391
542
|
markup: model.rationale || '',
|
|
392
543
|
onChange: this.onRationaleChanged,
|
|
393
544
|
imageSupport: imageSupport,
|
|
394
|
-
toolbarOpts: toolbarOpts
|
|
545
|
+
toolbarOpts: toolbarOpts,
|
|
546
|
+
spellCheck: spellCheckEnabled,
|
|
547
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
548
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
549
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
550
|
+
languageCharactersProps: [{
|
|
551
|
+
language: 'spanish'
|
|
552
|
+
}, {
|
|
553
|
+
language: 'special'
|
|
554
|
+
}]
|
|
395
555
|
})))));
|
|
396
556
|
}
|
|
397
557
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["toggle","settings","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","color","fontFamily","fontSize","lineHeight","marginTop","createElementFromHTML","htmlString","div","document","createElement","innerHTML","trim","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","maxLengthPerChoice","index","newValLength","length","label","value","splice","domMarkup","allRespAreas","querySelectorAll","allChoices","updatedMaxLengthPerChoice","forEach","el","newChoices","dataset","undefinedLengths","setState","Object","values","choice","labelLengthsArr","map","Math","max","classes","configuration","onConfigurationChanged","imageSupport","partialScoring","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","maxLengthPerChoiceEnabled","toolbarOpts","toolbarEditorPosition","position","onModelChange","Settings","Properties","onTeacherInstructionsChanged","onPromptChanged","ALL_PLUGINS","type","options","duplicates","respAreaToolbar","node","onToolbarDone","correctChoice","data","get","onChangeResponse","onChange","onBlur","onResponsesChanged","onLengthChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAQA,MAAR,GAA0BC,kBAA1B,CAAQD,MAAR;AAAA,IAAgBE,KAAhB,GAA0BD,kBAA1B,CAAgBC,KAAhB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADS;AAMvBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANe;AAUvBO,IAAAA,MAAM,EAAE;AACNC,MAAAA,SAAS,EAAE,OADL;AAENF,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAF3B;AAGNH,MAAAA,KAAK,EAAE,MAHD;AAIN,sCAAgC;AAC9BQ,QAAAA,SAAS,EAAE;AADmB;AAJ1B,KAVe;AAkBvBC,IAAAA,MAAM,EAAE;AACNH,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAD3B,KAlBe;AAqBvBO,IAAAA,mBAAmB,EAAE;AACnBJ,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CADd;AAEnBF,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAFjB,KArBE;AAyBv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Jd;AAKjBnC,EAAAA,sBAAsB,EAAEiC,sBAAUK,IAAV,CAAeH,UALtB;AAMjBrC,EAAAA,OAAO,EAAEmC,sBAAUC,MAAV,CAAiBC,UANT;AAOjBlC,EAAAA,YAAY,EAAEgC,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AAPG,C;AAsTrB,IAAMM,MAAM,GAAG,wBAAW5G,MAAX,EAAmB+B,IAAnB,CAAf;eAEe6E,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport EditableHtml, {ALL_PLUGINS} from '@pie-lib/editable-html';\nimport {InputContainer, layout, settings} from '@pie-lib/config-ui';\nimport {withStyles} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ECRToolbar from './ecr-toolbar';\nimport AlternateResponses from './alternateResponses';\nimport { getAdjustedLength } from './markupUtils';\n\nconst { toggle, Panel } = settings;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n markup: {\n minHeight: '100px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '100px'\n }\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n text: {\n color: '#495B8F',\n fontFamily: 'Cerebri Sans',\n fontSize: '16px',\n lineHeight: '19px',\n marginTop: theme.spacing.unit * 4\n }\n});\n\nconst createElementFromHTML = htmlString => {\n const div = document.createElement('div');\n\n div.innerHTML = htmlString.trim();\n\n return div;\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {};\n\n componentDidMount() {\n const {\n model: { slateMarkup, choices, maxLengthPerChoice = []},\n onModelChanged\n } = this.props;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n this.setState({ markup: slateMarkup });\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map(choice => (choice.label || '').length);\n const length = getAdjustedLength(Math.max(...labelLengthsArr));\n\n if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length) {\n maxLengthPerChoice[index] = length;\n }\n });\n\n onModelChanged({\n ...this.props.model,\n maxLengthPerChoice\n });\n }\n\n onModelChange = newVal => {\n this.props.onModelChanged({\n ...this.props.model,\n ...newVal\n });\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onRationaleChanged = rationale => {\n this.props.onModelChanged({\n ...this.props.model,\n rationale\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n teacherInstructions\n });\n };\n\n onMarkupChanged = slateMarkup => {\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup\n });\n };\n\n onResponsesChanged = choices => {\n this.props.onModelChanged({\n ...this.props.model,\n choices\n });\n };\n\n onLengthChanged = maxLengthPerChoice => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n maxLengthPerChoice\n });\n };\n\n onChangeResponse = (index, newVal) => {\n const { model, onModelChanged} = this.props;\n const { choices, maxLengthPerChoice } = model;\n const newValLength = getAdjustedLength((newVal || '').length);\n\n if (!choices[index]) {\n choices[index] = [{ label: '', value: '0' }];\n maxLengthPerChoice.splice(index, 0, newValLength);\n }\n\n choices[index][0].label = newVal || '';\n\n if (maxLengthPerChoice && newVal && maxLengthPerChoice[index] < newValLength) {\n maxLengthPerChoice[index] = newValLength;\n }\n\n onModelChanged({\n ...model,\n choices,\n maxLengthPerChoice\n });\n };\n\n onChange = markup => {\n const {\n model: { choices, maxLengthPerChoice }\n } = this.props;\n const domMarkup = createElementFromHTML(markup);\n const allRespAreas = domMarkup.querySelectorAll(\n '[data-type=\"explicit_constructed_response\"]'\n );\n\n const allChoices = {};\n const updatedMaxLengthPerChoice = [];\n\n allRespAreas.forEach((el, index) => {\n const newChoices = cloneDeep(choices[el.dataset.index]);\n\n if (newChoices) {\n newChoices[0] = {\n label: el.dataset.value || '',\n value: '0'\n };\n\n updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];\n }\n\n allChoices[index] = newChoices;\n el.dataset.index = index;\n });\n\n this.props.onModelChanged({\n ...this.props.model,\n choices: allChoices,\n slateMarkup: domMarkup.innerHTML,\n maxLengthPerChoice: updatedMaxLengthPerChoice\n });\n };\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n imageSupport\n } = this.props;\n const {\n prompt = {},\n partialScoring = {},\n rationale = {},\n teacherInstructions = {},\n maxLengthPerChoice = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, maxLengthPerChoiceEnabled } = model || {};\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => this.onModelChange(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n maxLengthPerChoiceEnabled:\n maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n }\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n <Typography className={classes.text}>\n Define Template, Choices, and Correct Responses\n </Typography>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n responseAreaProps={{\n type: 'explicit-constructed-response',\n options: {\n duplicates: true\n },\n respAreaToolbar: (node, value, onToolbarDone) => {\n const { model } = this.props;\n const correctChoice = (model.choices[\n node.data.get('index')\n ] || [])[0];\n\n return () => (\n <ECRToolbar\n onChangeResponse={newVal =>\n this.onChangeResponse(node.data.get('index'), newVal)\n }\n node={node}\n value={value}\n onToolbarDone={onToolbarDone}\n correctChoice={correctChoice}\n />\n );\n }\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onChange}\n imageSupport={imageSupport}\n onBlur={this.onBlur}\n disabled={false}\n highlightShape={false}\n />\n {!isEmpty(model.choices) && (\n <Typography className={classes.text}>\n {`Define Alternates ${maxLengthPerChoiceEnabled ? 'and Character Limits' : ''}`}\n </Typography>\n )}\n <AlternateResponses\n model={model}\n onChange={this.onResponsesChanged}\n onLengthChange={this.onLengthChanged}\n maxLengthPerChoiceEnabled={maxLengthPerChoiceEnabled}\n />\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["toggle","settings","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","color","fontFamily","fontSize","typography","lineHeight","marginTop","tooltip","whiteSpace","maxWidth","errorText","flexContainer","display","alignItems","createElementFromHTML","htmlString","div","document","createElement","innerHTML","trim","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","maxLengthPerChoice","index","newValLength","length","label","value","nbOfMissingChoices","Array","fill","splice","domMarkup","allRespAreas","querySelectorAll","allChoices","updatedMaxLengthPerChoice","forEach","el","newChoices","dataset","callback","setState","cachedChoices","undefined","nodes","state","newCachedChoices","node","keyForNode","data","get","Object","assign","hasOwnProperty","trailing","leading","undefinedLengths","values","choice","labelLengthsArr","map","Math","max","classes","configuration","onConfigurationChanged","imageSupport","uploadSoundSupport","maxImageWidth","maxImageHeight","maxResponseAreas","partialScoring","playerSpellCheck","settingsPanelDisabled","spellCheck","withRubric","errors","maxLengthPerChoiceEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","choicesErrors","responseAreasError","validationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","panelProperties","playerSpellCheckEnabled","rubricEnabled","onModelChange","Settings","Properties","onTeacherInstructionsChanged","language","onPromptChanged","marginLeft","ALL_PLUGINS","type","options","duplicates","respAreaToolbar","onToolbarDone","correctChoice","onChangeResponse","error","onHandleAreaChange","onChange","onBlur","onResponsesChanged","onLengthChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAQA,MAAR,GAA0BC,kBAA1B,CAAQD,MAAR;AAAA,IAAgBE,KAAhB,GAA0BD,kBAA1B,CAAgBC,KAAhB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADW;AAMzBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANiB;AAUzBO,IAAAA,MAAM,EAAE;AACNC,MAAAA,SAAS,EAAE,OADL;AAENF,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAF3B;AAGNH,MAAAA,KAAK,EAAE,MAHD;AAIN,sCAAgC;AAC9BQ,QAAAA,SAAS,EAAE;AADmB;AAJ1B,KAViB;AAkBzBC,IAAAA,MAAM,EAAE;AACNH,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAA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AG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AAPG,C;AAyXrB,IAAMM,MAAM,GAAG,wBAAWzJ,MAAX,EAAmBuC,IAAnB,CAAf;eAEekH,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\nimport throttle from 'lodash/throttle';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html';\n// import EditableHtmlNew from 'editable-html';\nimport { InputContainer, layout, settings } from '@pie-lib/config-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport ECRToolbar from './ecr-toolbar';\nimport AlternateResponses from './alternateResponses';\nimport { getAdjustedLength } from './markupUtils';\nimport { generateValidationMessage } from './utils';\n\nconst { toggle, Panel } = settings;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n markup: {\n minHeight: '100px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '100px',\n },\n },\n design: {\n paddingTop: theme.spacing.unit * 3,\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0,\n },\n addButton: {\n float: 'right',\n },\n text: {\n color: '#495B8F',\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize + 2,\n lineHeight: '19px',\n marginTop: theme.spacing.unit * 4,\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: 'red',\n paddingTop: theme.spacing.unit,\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'end',\n },\n});\n\nconst createElementFromHTML = (htmlString) => {\n const div = document.createElement('div');\n div.innerHTML = htmlString.trim();\n\n return div;\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = {};\n\n componentDidMount() {\n const {\n model: { slateMarkup, choices, maxLengthPerChoice = [] },\n onModelChanged,\n } = this.props;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n this.setState({ markup: slateMarkup });\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map((choice) => (choice.label || '').length);\n const length = Math.max(...labelLengthsArr);\n\n if (\n undefinedLengths ||\n !maxLengthPerChoice[index] ||\n maxLengthPerChoice[index] < length ||\n maxLengthPerChoice[index] > length + 10\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(length);\n }\n });\n\n onModelChanged({ ...this.props.model, maxLengthPerChoice });\n }\n\n onModelChange = (newVal) => {\n this.props.onModelChanged({ ...this.props.model, ...newVal });\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({ ...this.props.model, prompt });\n };\n\n onRationaleChanged = (rationale) => {\n this.props.onModelChanged({ ...this.props.model, rationale });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({ ...model, teacherInstructions });\n };\n\n onMarkupChanged = (slateMarkup) => {\n this.props.onModelChanged({ ...this.props.model, slateMarkup });\n };\n\n onResponsesChanged = (choices) => {\n this.props.onModelChanged({ ...this.props.model, choices });\n };\n\n onLengthChanged = (maxLengthPerChoice) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({ ...model, maxLengthPerChoice });\n };\n\n onChangeResponse = (index, newVal) => {\n const { model, onModelChanged } = this.props;\n const { choices } = model;\n let { maxLengthPerChoice } = model;\n const newValLength = (newVal || '').length;\n\n if (!choices[index]) {\n choices[index] = [{ label: newVal || '', value: '0' }];\n\n // add default values for missing choices up to the new index position\n const nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;\n\n maxLengthPerChoice = [...maxLengthPerChoice, ...Array(nbOfMissingChoices).fill(1)];\n\n maxLengthPerChoice.splice(index, 0, getAdjustedLength(newValLength));\n } else {\n choices[index][0].label = newVal || '';\n\n if (\n maxLengthPerChoice &&\n (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(newValLength);\n }\n }\n\n onModelChanged({ ...model, choices, maxLengthPerChoice });\n };\n\n onChange = (markup) => {\n const {\n model: { choices, maxLengthPerChoice },\n onModelChanged,\n } = this.props;\n const domMarkup = createElementFromHTML(markup);\n const allRespAreas = domMarkup.querySelectorAll('[data-type=\"explicit_constructed_response\"]');\n\n const allChoices = {};\n const updatedMaxLengthPerChoice = [];\n\n allRespAreas.forEach((el, index) => {\n const newChoices = cloneDeep(choices[el.dataset.index]);\n\n if (newChoices) {\n newChoices[0] = {\n label: el.dataset.value || '',\n value: '0',\n };\n\n updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];\n }\n\n allChoices[index] = newChoices;\n el.dataset.index = index;\n });\n\n const callback = () =>\n onModelChanged({\n ...this.props.model,\n choices: allChoices,\n slateMarkup: domMarkup.innerHTML,\n maxLengthPerChoice: updatedMaxLengthPerChoice,\n });\n\n this.setState({ cachedChoices: undefined }, callback);\n };\n\n onHandleAreaChange = throttle(\n (nodes) => {\n const {\n model: { choices },\n onModelChanged,\n } = this.props;\n const { cachedChoices } = this.state;\n\n if (!nodes) {\n return;\n }\n\n const newChoices = choices ? cloneDeep(choices) : {};\n const newCachedChoices = cachedChoices ? cloneDeep(cachedChoices) : {};\n\n nodes.forEach((node) => {\n const keyForNode = node.data.get('index');\n\n if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {\n Object.assign(newChoices, pick(newCachedChoices, keyForNode));\n\n if (newCachedChoices.hasOwnProperty(keyForNode)) {\n delete newCachedChoices[keyForNode];\n }\n } else {\n Object.assign(newCachedChoices, pick(newChoices, keyForNode));\n\n if (newChoices.hasOwnProperty(keyForNode)) {\n delete newChoices[keyForNode];\n }\n }\n });\n\n const callback = () => onModelChanged({ ...this.props.model, choices: newChoices });\n\n this.setState({ cachedChoices: newCachedChoices }, callback);\n },\n 500,\n { trailing: false, leading: true },\n );\n\n render() {\n const { classes, model, configuration, onConfigurationChanged, imageSupport, uploadSoundSupport } = this.props;\n const {\n maxImageWidth = {},\n maxImageHeight = {},\n maxLengthPerChoice = {},\n maxResponseAreas,\n partialScoring = {},\n playerSpellCheck = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n spellCheck = {},\n teacherInstructions = {},\n withRubric = {},\n } = configuration || {};\n const {\n errors,\n maxLengthPerChoiceEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n\n const { choicesErrors = {}, responseAreasError } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => this.onModelChange(model)}\n onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n <div className={classes.flexContainer}>\n <Typography className={classes.text}>Define Template, Choices, and Correct Responses</Typography>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n </div>\n\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n spellCheck={spellCheckEnabled}\n responseAreaProps={{\n type: 'explicit-constructed-response',\n options: {\n duplicates: true,\n },\n maxResponseAreas: maxResponseAreas,\n respAreaToolbar: (node, value, onToolbarDone) => {\n const { model } = this.props;\n const correctChoice = (model.choices[node.data.get('index')] || [])[0];\n\n return () => (\n <ECRToolbar\n onChangeResponse={(newVal) => this.onChangeResponse(node.data.get('index'), newVal)}\n node={node}\n value={value}\n onToolbarDone={onToolbarDone}\n correctChoice={correctChoice}\n />\n );\n },\n error: () => choicesErrors,\n onHandleAreaChange: this.onHandleAreaChange,\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onChange}\n imageSupport={imageSupport}\n disableImageAlignmentButtons={true}\n onBlur={this.onBlur}\n disabled={false}\n highlightShape={false}\n error={responseAreasError}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n {responseAreasError && <div className={classes.errorText}>{responseAreasError}</div>}\n\n {!isEmpty(model.choices) && (\n <Typography className={classes.text}>\n {`Define Alternates ${maxLengthPerChoiceEnabled ? 'and Character Limits' : ''}`}\n </Typography>\n )}\n <AlternateResponses\n model={model}\n onChange={this.onResponsesChanged}\n onLengthChange={this.onLengthChanged}\n maxLengthPerChoiceEnabled={maxLengthPerChoiceEnabled}\n spellCheck={spellCheckEnabled}\n choicesErrors={choicesErrors}\n />\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
|
@@ -5,13 +5,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.removeUnwantedCharacters = exports.processMarkup = exports.getAdjustedLength = exports.createSlateMarkup = void 0;
|
|
9
9
|
|
|
10
10
|
var _escape = _interopRequireDefault(require("lodash/escape"));
|
|
11
11
|
|
|
12
|
+
// do not remove \t from \times, \triangle, \tan, \theta or \therefore
|
|
13
|
+
var tSymbols = 'imes|riangle|an|heta|herefore'; // do not remove \n from \nthroot, \nparallel, \ncong, \napprox, \neq, \ne or \nsim
|
|
14
|
+
|
|
15
|
+
var nSymbols = 'throot|parallel|cong|approx|eq|e|sim'; // match all \t and \n that are not part of math symbols that starts with \t or \n
|
|
16
|
+
|
|
17
|
+
var matchTabAndNewLine = new RegExp("(\\t(?!".concat(tSymbols, "))|(\\n(?!").concat(nSymbols, "))|(\\\\t(?!").concat(tSymbols, "))|(\\\\n(?!").concat(nSymbols, "))"), 'g');
|
|
18
|
+
|
|
12
19
|
var removeUnwantedCharacters = function removeUnwantedCharacters(markup) {
|
|
13
|
-
return markup
|
|
14
|
-
.replace(/(\t(?!imes|riangle|an|heta))|(\n)|(\\t(?!imes|riangle|an|heta))|(\\n)/g, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
|
|
20
|
+
return markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
exports.removeUnwantedCharacters = removeUnwantedCharacters;
|