@pie-element/explicit-constructed-response 6.12.1-next.1 → 6.12.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/configure/lib/alternateResponses.js +243 -0
  2. package/configure/lib/alternateResponses.js.map +1 -0
  3. package/configure/lib/alternateSection.js +403 -0
  4. package/configure/lib/alternateSection.js.map +1 -0
  5. package/configure/lib/defaults.js +188 -0
  6. package/configure/lib/defaults.js.map +1 -0
  7. package/configure/lib/ecr-toolbar.js +184 -0
  8. package/configure/lib/ecr-toolbar.js.map +1 -0
  9. package/configure/lib/index.js +228 -0
  10. package/configure/lib/index.js.map +1 -0
  11. package/configure/lib/main.js +611 -0
  12. package/configure/lib/main.js.map +1 -0
  13. package/configure/lib/markupUtils.js +77 -0
  14. package/configure/lib/markupUtils.js.map +1 -0
  15. package/configure/lib/utils.js +15 -0
  16. package/configure/lib/utils.js.map +1 -0
  17. package/configure/package.json +1 -1
  18. package/controller/lib/defaults.js +18 -0
  19. package/controller/lib/defaults.js.map +1 -0
  20. package/controller/lib/index.js +382 -0
  21. package/controller/lib/index.js.map +1 -0
  22. package/controller/package.json +1 -1
  23. package/lib/index.js +124 -0
  24. package/lib/index.js.map +1 -0
  25. package/lib/main.js +279 -0
  26. package/lib/main.js.map +1 -0
  27. package/lib/print.js +115 -0
  28. package/lib/print.js.map +1 -0
  29. package/module/configure.js +17141 -0
  30. package/module/controller.js +24943 -0
  31. package/module/demo.js +45 -0
  32. package/module/element.js +128390 -0
  33. package/module/index.html +21 -0
  34. package/module/manifest.json +14 -0
  35. package/module/print-demo.js +83 -0
  36. package/module/print.html +18 -0
  37. package/module/print.js +128333 -0
  38. package/package.json +3 -3
@@ -0,0 +1,611 @@
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$baseInputConfigu = _ref.baseInputConfiguration,
340
+ baseInputConfiguration = _ref$baseInputConfigu === void 0 ? {} : _ref$baseInputConfigu,
341
+ _ref$contentDimension = _ref.contentDimensions,
342
+ contentDimensions = _ref$contentDimension === void 0 ? {} : _ref$contentDimension,
343
+ _ref$maxImageWidth = _ref.maxImageWidth,
344
+ maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
345
+ _ref$maxImageHeight = _ref.maxImageHeight,
346
+ maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight,
347
+ _ref$maxLengthPerChoi = _ref.maxLengthPerChoice,
348
+ maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi,
349
+ maxResponseAreas = _ref.maxResponseAreas,
350
+ _ref$partialScoring = _ref.partialScoring,
351
+ partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring,
352
+ _ref$playerSpellCheck = _ref.playerSpellCheck,
353
+ playerSpellCheck = _ref$playerSpellCheck === void 0 ? {} : _ref$playerSpellCheck,
354
+ _ref$prompt = _ref.prompt,
355
+ prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
356
+ _ref$rationale = _ref.rationale,
357
+ rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
358
+ _ref$template = _ref.template,
359
+ template = _ref$template === void 0 ? {} : _ref$template,
360
+ settingsPanelDisabled = _ref.settingsPanelDisabled,
361
+ _ref$spellCheck = _ref.spellCheck,
362
+ spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
363
+ _ref$editSource = _ref.editSource,
364
+ editSource = _ref$editSource === void 0 ? {} : _ref$editSource,
365
+ _ref$teacherInstructi = _ref.teacherInstructions,
366
+ teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
367
+ _ref$withRubric = _ref.withRubric,
368
+ withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric,
369
+ _ref$mathMlOptions = _ref.mathMlOptions,
370
+ mathMlOptions = _ref$mathMlOptions === void 0 ? {} : _ref$mathMlOptions,
371
+ _ref$language = _ref.language,
372
+ language = _ref$language === void 0 ? {} : _ref$language,
373
+ _ref$languageChoices = _ref.languageChoices,
374
+ languageChoices = _ref$languageChoices === void 0 ? {} : _ref$languageChoices;
375
+
376
+ var _ref2 = model || {},
377
+ errors = _ref2.errors,
378
+ maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled,
379
+ promptEnabled = _ref2.promptEnabled,
380
+ rationaleEnabled = _ref2.rationaleEnabled,
381
+ spellCheckEnabled = _ref2.spellCheckEnabled,
382
+ teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
383
+ toolbarEditorPosition = _ref2.toolbarEditorPosition;
384
+
385
+ var _ref3 = errors || {},
386
+ _ref3$choices = _ref3.choices,
387
+ choicesErrors = _ref3$choices === void 0 ? {} : _ref3$choices,
388
+ promptError = _ref3.prompt,
389
+ rationaleError = _ref3.rationale,
390
+ responseAreasError = _ref3.responseAreas,
391
+ teacherInstructionsError = _ref3.teacherInstructions;
392
+
393
+ var validationMessage = (0, _utils.generateValidationMessage)(configuration);
394
+ var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
395
+ var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
396
+ var toolbarOpts = {
397
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
398
+ };
399
+ var panelSettings = {
400
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
401
+ maxLengthPerChoiceEnabled: maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),
402
+ 'language.enabled': language.settings && toggle(language.label, true),
403
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
404
+ };
405
+ var panelProperties = {
406
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
407
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
408
+ promptEnabled: prompt.settings && toggle(prompt.label),
409
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
410
+ playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),
411
+ rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label),
412
+ 'editSource.enabled': (editSource === null || editSource === void 0 ? void 0 : editSource.settings) && toggle(editSource.label, true)
413
+ };
414
+
415
+ var getPluginProps = function getPluginProps() {
416
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
417
+ return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
418
+ };
419
+
420
+ return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
421
+ dimensions: contentDimensions,
422
+ hideSettings: settingsPanelDisabled,
423
+ settings: /*#__PURE__*/_react["default"].createElement(Panel, {
424
+ model: model,
425
+ configuration: configuration,
426
+ onChangeModel: function onChangeModel(model) {
427
+ return _this2.onModelChange(model);
428
+ },
429
+ onChangeConfiguration: function onChangeConfiguration(configuration) {
430
+ return onConfigurationChanged(configuration, true);
431
+ },
432
+ groups: {
433
+ Settings: panelSettings,
434
+ Properties: panelProperties
435
+ }
436
+ })
437
+ }, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
438
+ label: teacherInstructions.label,
439
+ className: classes.promptHolder
440
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
441
+ className: classes.prompt,
442
+ markup: model.teacherInstructions || '',
443
+ onChange: this.onTeacherInstructionsChanged,
444
+ imageSupport: imageSupport,
445
+ nonEmpty: false,
446
+ error: teacherInstructionsError,
447
+ toolbarOpts: toolbarOpts,
448
+ pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
449
+ spellCheck: spellCheckEnabled,
450
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
451
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
452
+ uploadSoundSupport: uploadSoundSupport,
453
+ languageCharactersProps: [{
454
+ language: 'spanish'
455
+ }, {
456
+ language: 'special'
457
+ }],
458
+ mathMlOptions: mathMlOptions
459
+ }), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
460
+ className: classes.errorText
461
+ }, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
462
+ label: prompt.label,
463
+ className: classes.promptHolder
464
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
465
+ className: classes.prompt,
466
+ markup: model.prompt,
467
+ onChange: this.onPromptChanged,
468
+ imageSupport: imageSupport,
469
+ nonEmpty: false,
470
+ disableUnderline: true,
471
+ error: promptError,
472
+ toolbarOpts: toolbarOpts,
473
+ pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
474
+ spellCheck: spellCheckEnabled,
475
+ maxImageWidth: defaultImageMaxWidth,
476
+ maxImageHeight: defaultImageMaxHeight,
477
+ uploadSoundSupport: uploadSoundSupport,
478
+ languageCharactersProps: [{
479
+ language: 'spanish'
480
+ }, {
481
+ language: 'special'
482
+ }],
483
+ mathMlOptions: mathMlOptions
484
+ }), promptError && /*#__PURE__*/_react["default"].createElement("div", {
485
+ className: classes.errorText
486
+ }, promptError)), /*#__PURE__*/_react["default"].createElement("div", {
487
+ className: classes.flexContainer
488
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
489
+ className: classes.text
490
+ }, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
491
+ classes: {
492
+ tooltip: classes.tooltip
493
+ },
494
+ disableFocusListener: true,
495
+ disableTouchListener: true,
496
+ placement: 'right',
497
+ title: validationMessage
498
+ }, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
499
+ fontSize: 'small',
500
+ color: 'primary',
501
+ style: {
502
+ marginLeft: '8px'
503
+ }
504
+ }))), /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
505
+ activePlugins: _editableHtml.ALL_PLUGINS,
506
+ toolbarOpts: {
507
+ position: 'top'
508
+ },
509
+ spellCheck: spellCheckEnabled,
510
+ pluginProps: getPluginProps(template === null || template === void 0 ? void 0 : template.inputConfiguration),
511
+ responseAreaProps: {
512
+ type: 'explicit-constructed-response',
513
+ options: {
514
+ duplicates: true
515
+ },
516
+ maxResponseAreas: maxResponseAreas,
517
+ respAreaToolbar: function respAreaToolbar(node, value, onToolbarDone) {
518
+ var model = _this2.props.model;
519
+ var correctChoice = (model.choices[node.data.get('index')] || [])[0];
520
+ return function () {
521
+ return /*#__PURE__*/_react["default"].createElement(_ecrToolbar["default"], {
522
+ onChangeResponse: function onChangeResponse(newVal) {
523
+ return _this2.onChangeResponse(node.data.get('index'), newVal);
524
+ },
525
+ node: node,
526
+ value: value,
527
+ onToolbarDone: onToolbarDone,
528
+ correctChoice: correctChoice,
529
+ maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled
530
+ });
531
+ };
532
+ },
533
+ error: function error() {
534
+ return choicesErrors;
535
+ },
536
+ onHandleAreaChange: this.onHandleAreaChange
537
+ },
538
+ className: classes.markup,
539
+ markup: model.slateMarkup,
540
+ onChange: this.onChange,
541
+ imageSupport: imageSupport,
542
+ disableImageAlignmentButtons: true,
543
+ onBlur: this.onBlur,
544
+ disabled: false,
545
+ highlightShape: false,
546
+ error: responseAreasError,
547
+ uploadSoundSupport: uploadSoundSupport,
548
+ languageCharactersProps: [{
549
+ language: 'spanish'
550
+ }, {
551
+ language: 'special'
552
+ }],
553
+ mathMlOptions: mathMlOptions
554
+ }), responseAreasError && /*#__PURE__*/_react["default"].createElement("div", {
555
+ className: classes.errorText
556
+ }, responseAreasError), !(0, _isEmpty["default"])(model.choices) && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
557
+ className: (0, _classnames["default"])(classes.text, classes.responseHeader)
558
+ }, "Define Alternates ".concat(maxLengthPerChoiceEnabled ? 'and Character Limits' : '')), /*#__PURE__*/_react["default"].createElement(_alternateResponses["default"], {
559
+ model: model,
560
+ onChange: this.onResponsesChanged,
561
+ onLengthChange: this.onLengthChanged,
562
+ maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
563
+ spellCheck: spellCheckEnabled,
564
+ choicesErrors: choicesErrors
565
+ }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
566
+ label: rationale.label,
567
+ className: classes.promptHolder
568
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
569
+ className: classes.prompt,
570
+ markup: model.rationale || '',
571
+ onChange: this.onRationaleChanged,
572
+ imageSupport: imageSupport,
573
+ error: rationaleError,
574
+ toolbarOpts: toolbarOpts,
575
+ pluginProps: getPluginProps(rationale === null || rationale === void 0 ? void 0 : rationale.inputConfiguration),
576
+ spellCheck: spellCheckEnabled,
577
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
578
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
579
+ uploadSoundSupport: uploadSoundSupport,
580
+ languageCharactersProps: [{
581
+ language: 'spanish'
582
+ }, {
583
+ language: 'special'
584
+ }],
585
+ mathMlOptions: mathMlOptions
586
+ }), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
587
+ className: classes.errorText
588
+ }, rationaleError)));
589
+ }
590
+ }]);
591
+ return Main;
592
+ }(_react["default"].Component);
593
+
594
+ exports.Main = Main;
595
+ (0, _defineProperty2["default"])(Main, "propTypes", {
596
+ configuration: _propTypes["default"].object.isRequired,
597
+ model: _propTypes["default"].object.isRequired,
598
+ disableSidePanel: _propTypes["default"].bool,
599
+ onModelChanged: _propTypes["default"].func.isRequired,
600
+ onConfigurationChanged: _propTypes["default"].func.isRequired,
601
+ classes: _propTypes["default"].object.isRequired,
602
+ imageSupport: _propTypes["default"].shape({
603
+ add: _propTypes["default"].func.isRequired,
604
+ "delete": _propTypes["default"].func.isRequired
605
+ }),
606
+ uploadSoundSupport: _propTypes["default"].object
607
+ });
608
+ var Styled = (0, _styles.withStyles)(styles)(Main);
609
+ var _default = Styled;
610
+ exports["default"] = _default;
611
+ //# sourceMappingURL=main.js.map