@pie-element/explicit-constructed-response 6.4.1-next.41 → 6.4.1-next.42

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