@pie-element/inline-dropdown 3.7.0 → 3.7.1-beta.587

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.
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
@@ -45,56 +45,43 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
45
45
 
46
46
  var _reduce = _interopRequireDefault(require("lodash/reduce"));
47
47
 
48
+ var _max = _interopRequireDefault(require("lodash/max"));
49
+
48
50
  var _styles = require("@material-ui/core/styles");
49
51
 
50
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
52
+ var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
51
53
 
52
- var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
54
+ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
53
55
 
54
- var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
56
+ var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
55
57
 
56
- var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
58
+ var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
57
59
 
58
- var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
60
+ var _ExpansionPanelDetails = _interopRequireDefault(require("@material-ui/core/ExpansionPanelDetails"));
61
+
62
+ var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
63
+
64
+ var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
59
65
 
60
66
  var _inlineDropdownToolbar = _interopRequireDefault(require("./inline-dropdown-toolbar"));
61
67
 
62
- var _max = _interopRequireDefault(require("lodash/max"));
68
+ var _utils = require("./utils");
69
+
70
+ 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); }
63
71
 
64
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
72
+ 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; }
65
73
 
66
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
74
+ 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; }
75
+
76
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
67
77
 
68
78
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
69
79
 
70
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
80
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
71
81
 
72
82
  var toggle = _configUi.settings.toggle,
73
83
  Panel = _configUi.settings.Panel;
74
84
 
75
- var InfoDialog = function InfoDialog(_ref) {
76
- var open = _ref.open,
77
- onCancel = _ref.onCancel,
78
- onOk = _ref.onOk,
79
- title = _ref.title;
80
- return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
81
- open: open
82
- }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, onOk && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
83
- onClick: onOk,
84
- color: "primary"
85
- }, "OK"), onCancel && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
86
- onClick: onCancel,
87
- color: "primary"
88
- }, "Cancel")));
89
- };
90
-
91
- InfoDialog.propTypes = {
92
- open: _propTypes["default"].bool,
93
- onCancel: _propTypes["default"].func,
94
- onOk: _propTypes["default"].func,
95
- title: _propTypes["default"].string
96
- };
97
-
98
85
  var styles = function styles(theme) {
99
86
  return {
100
87
  promptHolder: {
@@ -130,16 +117,42 @@ var styles = function styles(theme) {
130
117
  },
131
118
  text: {
132
119
  fontFamily: 'Cerebri Sans',
133
- fontSize: '16px',
120
+ fontSize: theme.typography.fontSize + 2,
134
121
  lineHeight: '19px',
135
- color: '#495B8F'
122
+ color: '#495B8F',
123
+ marginRight: theme.spacing.unit
124
+ },
125
+ rationaleLabel: {
126
+ display: 'flex',
127
+ whiteSpace: 'break-spaces'
128
+ },
129
+ rationaleChoices: {
130
+ marginTop: theme.spacing.unit * 2
131
+ },
132
+ panelDetails: {
133
+ display: 'block'
134
+ },
135
+ flexContainer: {
136
+ display: 'flex',
137
+ alignItems: 'center',
138
+ marginBottom: theme.spacing.unit
139
+ },
140
+ tooltip: {
141
+ fontSize: theme.typography.fontSize - 2,
142
+ whiteSpace: 'pre',
143
+ maxWidth: '500px'
144
+ },
145
+ errorText: {
146
+ fontSize: theme.typography.fontSize - 2,
147
+ color: 'red',
148
+ paddingTop: theme.spacing.unit
136
149
  }
137
150
  };
138
151
  };
139
152
 
140
153
  var createElementFromHTML = function createElementFromHTML(htmlString) {
141
154
  var div = document.createElement('div');
142
- div.innerHTML = htmlString.trim();
155
+ div.innerHTML = (htmlString || '').trim();
143
156
  return div;
144
157
  };
145
158
 
@@ -166,7 +179,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
166
179
 
167
180
  _this = _super.call.apply(_super, [this].concat(args));
168
181
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
169
- dialog: {
182
+ warning: {
170
183
  open: false
171
184
  }
172
185
  });
@@ -183,6 +196,15 @@ var Main = /*#__PURE__*/function (_React$Component) {
183
196
  rationale: rationale
184
197
  });
185
198
  });
199
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceRationaleChanged", function (index, choice) {
200
+ var model = _this.props.model;
201
+ var indexOfChoice = model.choices && model.choices[index] && model.choices[index].findIndex(function (elem) {
202
+ return elem.label === choice.label && elem.value === choice.value;
203
+ });
204
+ model.choices[index] && model.choices[index].splice(indexOfChoice, 1, choice);
205
+
206
+ _this.onModelChange(model);
207
+ });
186
208
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
187
209
  _this.onModelChange({
188
210
  teacherInstructions: teacherInstructions
@@ -193,6 +215,28 @@ var Main = /*#__PURE__*/function (_React$Component) {
193
215
  slateMarkup: slateMarkup
194
216
  });
195
217
  });
218
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCheck", function (callback) {
219
+ _this.setState({
220
+ warning: {
221
+ open: true,
222
+ text: 'Response areas with under 2 options or with no correct answers will be discarded.',
223
+ onClose: function onClose() {
224
+ _this.setState({
225
+ warning: {
226
+ open: false
227
+ }
228
+ });
229
+ },
230
+ onConfirm: function onConfirm() {
231
+ _this.setState({
232
+ warning: {
233
+ open: false
234
+ }
235
+ }, callback);
236
+ }
237
+ }
238
+ });
239
+ });
196
240
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (markup) {
197
241
  var respAreaChoices = _this.state.respAreaChoices;
198
242
  var domMarkup = createElementFromHTML(markup);
@@ -226,12 +270,19 @@ var Main = /*#__PURE__*/function (_React$Component) {
226
270
 
227
271
  if (shouldWarn) {
228
272
  _this.setState({
229
- dialog: {
273
+ warning: {
230
274
  open: true,
231
- message: 'Response areas with under 2 options or with no correct answers will be discarded',
232
- onOk: function onOk() {
275
+ text: 'Response areas with under 2 options or with no correct answers will be discarded.',
276
+ onClose: function onClose() {
277
+ _this.setState({
278
+ warning: {
279
+ open: false
280
+ }
281
+ });
282
+ },
283
+ onConfirm: function onConfirm() {
233
284
  _this.setState({
234
- dialog: {
285
+ warning: {
235
286
  open: false
236
287
  }
237
288
  }, function () {
@@ -240,13 +291,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
240
291
  slateMarkup: domMarkup.innerHTML
241
292
  });
242
293
  });
243
- },
244
- onCancel: function onCancel() {
245
- return _this.setState({
246
- dialog: {
247
- open: false
248
- }
249
- });
250
294
  }
251
295
  }
252
296
  });
@@ -259,6 +303,26 @@ var Main = /*#__PURE__*/function (_React$Component) {
259
303
  });
260
304
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddChoice", function (index, label) {
261
305
  var respAreaChoices = _this.state.respAreaChoices;
306
+ var maxResponseAreaChoices = _this.props.configuration.maxResponseAreaChoices;
307
+
308
+ if (respAreaChoices[index] && respAreaChoices[index].length >= maxResponseAreaChoices) {
309
+ _this.setState({
310
+ warning: {
311
+ open: true,
312
+ text: "There are only ".concat(maxResponseAreaChoices, " answers allowed per choice."),
313
+ onClose: undefined,
314
+ onConfirm: function onConfirm() {
315
+ _this.setState({
316
+ warning: {
317
+ open: false
318
+ }
319
+ });
320
+ }
321
+ }
322
+ });
323
+
324
+ return;
325
+ }
262
326
 
263
327
  if (!respAreaChoices[index]) {
264
328
  respAreaChoices[index] = [];
@@ -268,12 +332,13 @@ var Main = /*#__PURE__*/function (_React$Component) {
268
332
  return prepareVal(r.label) === prepareVal(label);
269
333
  })) {
270
334
  _this.setState({
271
- dialog: {
335
+ warning: {
272
336
  open: true,
273
- message: 'Duplicate answers are not allowed.',
274
- onOk: function onOk() {
337
+ text: 'Duplicate answers are not allowed.',
338
+ onClose: undefined,
339
+ onConfirm: function onConfirm() {
275
340
  _this.setState({
276
- dialog: {
341
+ warning: {
277
342
  open: false
278
343
  }
279
344
  });
@@ -309,8 +374,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
309
374
  });
310
375
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSelectChoice", function (respIndex, selectedIndex) {
311
376
  var respAreaChoices = _this.state.respAreaChoices;
312
- respAreaChoices[respIndex] = respAreaChoices[respIndex].map(function (ch, index) {
313
- return _objectSpread(_objectSpread({}, ch), {}, {
377
+ respAreaChoices[respIndex] = respAreaChoices[respIndex].map(function (choice, index) {
378
+ return _objectSpread(_objectSpread({}, choice), {}, {
314
379
  correct: index === selectedIndex
315
380
  });
316
381
  });
@@ -356,34 +421,115 @@ var Main = /*#__PURE__*/function (_React$Component) {
356
421
  value: function render() {
357
422
  var _this2 = this;
358
423
 
359
- var dialog = this.state.dialog;
424
+ var warning = this.state.warning;
360
425
  var _this$props = this.props,
361
426
  classes = _this$props.classes,
362
427
  model = _this$props.model,
363
428
  configuration = _this$props.configuration,
364
429
  onConfigurationChanged = _this$props.onConfigurationChanged,
365
- imageSupport = _this$props.imageSupport;
366
-
367
- var _ref2 = configuration || {},
368
- _ref2$prompt = _ref2.prompt,
369
- prompt = _ref2$prompt === void 0 ? {} : _ref2$prompt,
370
- _ref2$partialScoring = _ref2.partialScoring,
371
- partialScoring = _ref2$partialScoring === void 0 ? {} : _ref2$partialScoring,
372
- _ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
373
- lockChoiceOrder = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
374
- _ref2$rationale = _ref2.rationale,
375
- rationale = _ref2$rationale === void 0 ? {} : _ref2$rationale,
376
- _ref2$teacherInstruct = _ref2.teacherInstructions,
377
- teacherInstructions = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct;
378
-
379
- var _ref3 = model || {},
380
- rationaleEnabled = _ref3.rationaleEnabled,
381
- promptEnabled = _ref3.promptEnabled,
382
- teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled;
383
-
430
+ imageSupport = _this$props.imageSupport,
431
+ uploadSoundSupport = _this$props.uploadSoundSupport;
432
+
433
+ var _ref = configuration || {},
434
+ _ref$choiceRationale = _ref.choiceRationale,
435
+ choiceRationale = _ref$choiceRationale === void 0 ? {} : _ref$choiceRationale,
436
+ _ref$lockChoiceOrder = _ref.lockChoiceOrder,
437
+ lockChoiceOrder = _ref$lockChoiceOrder === void 0 ? {} : _ref$lockChoiceOrder,
438
+ maxResponseAreas = _ref.maxResponseAreas,
439
+ _ref$maxImageWidth = _ref.maxImageWidth,
440
+ maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
441
+ _ref$maxImageHeight = _ref.maxImageHeight,
442
+ maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight,
443
+ _ref$partialScoring = _ref.partialScoring,
444
+ partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring,
445
+ _ref$prompt = _ref.prompt,
446
+ prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
447
+ _ref$rationale = _ref.rationale,
448
+ rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
449
+ settingsPanelDisabled = _ref.settingsPanelDisabled,
450
+ _ref$spellCheck = _ref.spellCheck,
451
+ spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
452
+ _ref$teacherInstructi = _ref.teacherInstructions,
453
+ teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
454
+ _ref$withRubric = _ref.withRubric,
455
+ withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric;
456
+
457
+ var _ref2 = model || {},
458
+ choiceRationaleEnabled = _ref2.choiceRationaleEnabled,
459
+ choices = _ref2.choices,
460
+ errors = _ref2.errors,
461
+ promptEnabled = _ref2.promptEnabled,
462
+ rationaleEnabled = _ref2.rationaleEnabled,
463
+ spellCheckEnabled = _ref2.spellCheckEnabled,
464
+ teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
465
+ toolbarEditorPosition = _ref2.toolbarEditorPosition;
466
+
467
+ var _ref3 = errors || {},
468
+ responseAreasError = _ref3.responseAreasError,
469
+ responseAreaChoicesError = _ref3.responseAreaChoicesError;
470
+
471
+ var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
472
+ var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
473
+
474
+ var renderChoiceRationale = function renderChoiceRationale() {
475
+ return (Object.keys(choices) || []).map(function (key, index) {
476
+ return /*#__PURE__*/_react["default"].createElement("div", {
477
+ key: key,
478
+ className: classes.rationaleChoices
479
+ }, /*#__PURE__*/_react["default"].createElement(_ExpansionPanel["default"], null, /*#__PURE__*/_react["default"].createElement(_ExpansionPanelSummary["default"], {
480
+ expandIcon: /*#__PURE__*/_react["default"].createElement(_ExpandMore["default"], null)
481
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
482
+ className: classes.text
483
+ }, "Rationale for response area #".concat(index + 1))), /*#__PURE__*/_react["default"].createElement(_ExpansionPanelDetails["default"], {
484
+ className: classes.panelDetails
485
+ }, (choices[key] || []).map(function (choice) {
486
+ return /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
487
+ key: choice.label,
488
+ label: /*#__PURE__*/_react["default"].createElement("span", {
489
+ className: classes.rationaleLabel,
490
+ dangerouslySetInnerHTML: {
491
+ __html: "".concat(rationale.label, " for ").concat(choice.label, " (").concat(choice.correct ? 'correct' : 'incorrect', ")")
492
+ }
493
+ }),
494
+ className: classes.promptHolder
495
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
496
+ className: classes.prompt,
497
+ markup: choice.rationale || '',
498
+ spellCheck: spellCheckEnabled,
499
+ onChange: function onChange(c) {
500
+ return _this2.onChoiceRationaleChanged(key, _objectSpread(_objectSpread({}, choice), {}, {
501
+ rationale: c
502
+ }));
503
+ },
504
+ imageSupport: imageSupport,
505
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
506
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
507
+ uploadSoundSupport: uploadSoundSupport
508
+ }));
509
+ }))));
510
+ });
511
+ };
512
+
513
+ var toolbarOpts = {
514
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
515
+ };
516
+ var validationMessage = (0, _utils.generateValidationMessage)(configuration);
517
+ var panelSettings = {
518
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
519
+ lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label)
520
+ };
521
+ var panelProperties = {
522
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
523
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
524
+ choiceRationaleEnabled: choiceRationale.settings && toggle(choiceRationale.label),
525
+ promptEnabled: prompt.settings && toggle(prompt.label),
526
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
527
+ rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
528
+ };
384
529
  return /*#__PURE__*/_react["default"].createElement("div", {
385
530
  className: classes.design
386
531
  }, /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
532
+ hideSettings: settingsPanelDisabled,
387
533
  settings: /*#__PURE__*/_react["default"].createElement(Panel, {
388
534
  model: model,
389
535
  configuration: configuration,
@@ -394,15 +540,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
394
540
  return onConfigurationChanged(configuration, true);
395
541
  },
396
542
  groups: {
397
- Settings: {
398
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
399
- lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label)
400
- },
401
- Properties: {
402
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
403
- rationaleEnabled: rationale.settings && toggle(rationale.label),
404
- promptEnabled: prompt.settings && toggle(prompt.label)
405
- }
543
+ Settings: panelSettings,
544
+ Properties: panelProperties
406
545
  }
407
546
  })
408
547
  }, /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
@@ -413,7 +552,17 @@ var Main = /*#__PURE__*/function (_React$Component) {
413
552
  markup: model.teacherInstructions || '',
414
553
  onChange: this.onTeacherInstructionsChanged,
415
554
  imageSupport: imageSupport,
416
- nonEmpty: false
555
+ nonEmpty: false,
556
+ toolbarOpts: toolbarOpts,
557
+ spellCheck: spellCheckEnabled,
558
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
559
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
560
+ uploadSoundSupport: uploadSoundSupport,
561
+ languageCharactersProps: [{
562
+ language: 'spanish'
563
+ }, {
564
+ language: 'special'
565
+ }]
417
566
  })), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
418
567
  label: prompt.label,
419
568
  className: classes.promptHolder
@@ -423,7 +572,17 @@ var Main = /*#__PURE__*/function (_React$Component) {
423
572
  onChange: this.onPromptChanged,
424
573
  imageSupport: imageSupport,
425
574
  nonEmpty: false,
426
- disableUnderline: true
575
+ disableUnderline: true,
576
+ toolbarOpts: toolbarOpts,
577
+ spellCheck: spellCheckEnabled,
578
+ maxImageWidth: defaultImageMaxWidth,
579
+ maxImageHeight: defaultImageMaxHeight,
580
+ uploadSoundSupport: uploadSoundSupport,
581
+ languageCharactersProps: [{
582
+ language: 'spanish'
583
+ }, {
584
+ language: 'special'
585
+ }]
427
586
  })), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
428
587
  label: rationale.label,
429
588
  className: classes.promptHolder
@@ -431,50 +590,95 @@ var Main = /*#__PURE__*/function (_React$Component) {
431
590
  className: classes.prompt,
432
591
  markup: model.rationale || '',
433
592
  onChange: this.onRationaleChanged,
434
- imageSupport: imageSupport
435
- })), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
593
+ imageSupport: imageSupport,
594
+ toolbarOpts: toolbarOpts,
595
+ spellCheck: spellCheckEnabled,
596
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
597
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
598
+ uploadSoundSupport: uploadSoundSupport,
599
+ languageCharactersProps: [{
600
+ language: 'spanish'
601
+ }, {
602
+ language: 'special'
603
+ }]
604
+ })), /*#__PURE__*/_react["default"].createElement("div", {
605
+ className: classes.flexContainer
606
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
436
607
  className: classes.text
437
- }, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(InfoDialog, {
438
- open: dialog.open,
439
- title: dialog.message,
440
- onCancel: dialog.onCancel,
441
- onOk: dialog.onOk
442
- }), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
608
+ }, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
609
+ classes: {
610
+ tooltip: classes.tooltip
611
+ },
612
+ disableFocusListener: true,
613
+ disableTouchListener: true,
614
+ placement: 'right',
615
+ title: validationMessage
616
+ }, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
617
+ fontSize: 'small',
618
+ color: 'primary'
619
+ }))), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
443
620
  activePlugins: _editableHtml.ALL_PLUGINS,
444
621
  toolbarOpts: {
445
622
  position: 'top'
446
623
  },
624
+ ref: function ref(_ref4) {
625
+ window.editorRef = _ref4;
626
+ },
447
627
  responseAreaProps: {
448
628
  type: 'inline-dropdown',
449
629
  options: {
450
630
  duplicates: true
451
631
  },
452
- respAreaToolbar: function respAreaToolbar(node, value, onToolbarDone) {
632
+ maxResponseAreas: maxResponseAreas,
633
+ respAreaToolbar: function respAreaToolbar(node, nodePath, editor, onToolbarDone) {
453
634
  var respAreaChoices = _this2.state.respAreaChoices;
454
635
  return function () {
455
636
  return /*#__PURE__*/_react["default"].createElement(_inlineDropdownToolbar["default"], {
456
637
  onAddChoice: _this2.onAddChoice,
638
+ onCheck: _this2.onCheck,
457
639
  onRemoveChoice: function onRemoveChoice(index) {
458
- return _this2.onRemoveChoice(node.data.get('index'), index);
640
+ return _this2.onRemoveChoice(node.data.index, index);
459
641
  },
460
642
  onSelectChoice: function onSelectChoice(index) {
461
- return _this2.onSelectChoice(node.data.get('index'), index);
643
+ return _this2.onSelectChoice(node.data.index, index);
462
644
  },
645
+ editor: editor,
463
646
  node: node,
464
- value: value,
647
+ nodePath: nodePath,
465
648
  onToolbarDone: onToolbarDone,
466
- choices: respAreaChoices[node.data.get('index')]
649
+ choices: respAreaChoices[node.data.index],
650
+ spellCheck: spellCheckEnabled,
651
+ uploadSoundSupport: uploadSoundSupport
467
652
  });
468
653
  };
469
654
  }
470
655
  },
656
+ spellCheck: spellCheckEnabled,
471
657
  className: classes.markup,
472
658
  markup: model.slateMarkup || '',
473
659
  onChange: this.onChange,
474
660
  imageSupport: imageSupport,
661
+ disableImageAlignmentButtons: true,
475
662
  onBlur: this.onBlur,
476
663
  disabled: false,
477
- highlightShape: false
664
+ highlightShape: false,
665
+ error: responseAreasError,
666
+ uploadSoundSupport: uploadSoundSupport,
667
+ languageCharactersProps: [{
668
+ language: 'spanish'
669
+ }, {
670
+ language: 'special'
671
+ }]
672
+ }), responseAreasError && /*#__PURE__*/_react["default"].createElement("div", {
673
+ className: classes.errorText
674
+ }, responseAreasError), responseAreaChoicesError && /*#__PURE__*/_react["default"].createElement("div", {
675
+ className: classes.errorText
676
+ }, responseAreaChoicesError), /*#__PURE__*/_react["default"].createElement("br", null), choiceRationaleEnabled && renderChoiceRationale(), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
677
+ open: warning.open,
678
+ title: "Warning",
679
+ text: warning.text,
680
+ onClose: warning.onClose,
681
+ onConfirm: warning.onConfirm
478
682
  }))));
479
683
  }
480
684
  }]);
@@ -492,6 +696,10 @@ exports.Main = Main;
492
696
  imageSupport: _propTypes["default"].shape({
493
697
  add: _propTypes["default"].func.isRequired,
494
698
  "delete": _propTypes["default"].func.isRequired
699
+ }),
700
+ uploadSoundSupport: _propTypes["default"].shape({
701
+ add: _propTypes["default"].func.isRequired,
702
+ "delete": _propTypes["default"].func.isRequired
495
703
  })
496
704
  });
497
705
  var Styled = (0, _styles.withStyles)(styles)(Main);