@pie-element/explicit-constructed-response 3.12.2 → 3.12.5

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,6 +1,6 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_lodash, _dll_material_ui__icons, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.3.1/module/index.js";
2
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.0.22/module/index.js";
3
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.22/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_lodash, _dll_material_ui__icons, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.8/module/index.js";
2
+ import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.7/module/index.js";
3
+ import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.31/module/index.js";
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6
6
  }
@@ -494,7 +494,9 @@ const {OutlinedInput: require$$11$4} = _dll_material_ui__core;
494
494
  args[_key] = arguments[_key];
495
495
  }
496
496
  _this = _super.call.apply(_super, [this].concat(args));
497
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {});
497
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
498
+ markup: ''
499
+ });
498
500
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDone", function () {
499
501
  var newValue = _this.state.markup;
500
502
  var _this$props = _this.props, node = _this$props.node, value = _this$props.value, onToolbarDone = _this$props.onToolbarDone, onChangeResponse = _this$props.onChangeResponse;
@@ -506,7 +508,7 @@ const {OutlinedInput: require$$11$4} = _dll_material_ui__core;
506
508
  });
507
509
  var nextText = value.document.getNextText(node.key);
508
510
  change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);
509
- onToolbarDone(change, false);
511
+ onToolbarDone(change, true);
510
512
  onChangeResponse(newValue);
511
513
  });
512
514
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (e) {
@@ -559,7 +561,7 @@ const {OutlinedInput: require$$11$4} = _dll_material_ui__core;
559
561
  },
560
562
  onChange: this.onChange,
561
563
  onBlur: this.onDone,
562
- value: markup
564
+ value: markup || ''
563
565
  }));
564
566
  }
565
567
  }]);
@@ -655,13 +657,13 @@ const require$$9$2 = _dll_react;
655
657
  const require$$10$3 = _dll_prop_types;
656
658
  const {debounce: require$$11$3} = _dll_lodash;
657
659
  const {isEqual: require$$12$3} = _dll_lodash;
658
- const {max: require$$22} = _dll_lodash;
660
+ const {max: require$$21} = _dll_lodash;
659
661
  const {OutlinedInput: require$$13$3} = _dll_material_ui__core;
660
662
  const {Button: require$$14$2} = _dll_material_ui__core;
661
663
  const {IconButton: require$$16$1} = _dll_material_ui__core;
662
664
  const {MenuItem: require$$17$1} = _dll_material_ui__core;
663
- const {Select: require$$18} = _dll_material_ui__core;
664
- const {TextField: require$$19} = _dll_material_ui__core;
665
+ const {Select: require$$18$1} = _dll_material_ui__core;
666
+ const {TextField: require$$19$1} = _dll_material_ui__core;
665
667
  const {Delete: require$$15$1} = _dll_material_ui__icons;
666
668
  const require$$20 = _dll_material_ui__core_styles;
667
669
  (function (exports) {
@@ -687,11 +689,11 @@ const require$$20 = _dll_material_ui__core_styles;
687
689
  var _Delete = _interopRequireDefault(require$$15$1);
688
690
  var _IconButton = _interopRequireDefault(require$$16$1);
689
691
  var _MenuItem = _interopRequireDefault(require$$17$1);
690
- var _Select = _interopRequireDefault(require$$18);
691
- var _TextField = _interopRequireDefault(require$$19);
692
+ var _Select = _interopRequireDefault(require$$18$1);
693
+ var _TextField = _interopRequireDefault(require$$19$1);
692
694
  var _styles = require$$20;
695
+ var _max = _interopRequireDefault(require$$21);
693
696
  var _markupUtils = markupUtils;
694
- var _max = _interopRequireDefault(require$$22);
695
697
  function ownKeys(object, enumerableOnly) {
696
698
  var keys = Object.keys(object);
697
699
  if (Object.getOwnPropertySymbols) {
@@ -817,7 +819,7 @@ const require$$20 = _dll_material_ui__core_styles;
817
819
  key: "render",
818
820
  value: function render() {
819
821
  var value = this.state.value;
820
- var _this$props = this.props, classes = _this$props.classes, onDelete = _this$props.onDelete;
822
+ var _this$props = this.props, classes = _this$props.classes, onDelete = _this$props.onDelete, spellCheck = _this$props.spellCheck;
821
823
  return _react["default"].createElement("div", {
822
824
  style: {
823
825
  alignItems: 'center',
@@ -829,7 +831,8 @@ const require$$20 = _dll_material_ui__core_styles;
829
831
  value: value,
830
832
  onChange: this.onChange,
831
833
  labelWidth: 0,
832
- disableUnderline: true
834
+ disableUnderline: true,
835
+ spellCheck: spellCheck
833
836
  }), _react["default"].createElement(_IconButton["default"], {
834
837
  "aria-label": "delete",
835
838
  className: classes.deleteBtn,
@@ -894,12 +897,12 @@ const require$$20 = _dll_material_ui__core_styles;
894
897
  return (choice.label || '').length;
895
898
  });
896
899
  labelLengthsArr[index] = value.length;
897
- var newLength = (0, _markupUtils.getAdjustedLength)(Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr)));
900
+ var newLength = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
898
901
  choiceChanged(_objectSpread(_objectSpread({}, choice), {}, {
899
902
  label: value
900
903
  }));
901
- if (newLength > maxLength || newLength + 10 < maxLength) {
902
- lengthChanged(newLength);
904
+ if (newLength > maxLength || newLength + 10 <= maxLength) {
905
+ lengthChanged((0, _markupUtils.getAdjustedLength)(newLength));
903
906
  }
904
907
  });
905
908
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onRemoveChoice", function (choice) {
@@ -914,7 +917,7 @@ const require$$20 = _dll_material_ui__core_styles;
914
917
  var labelLengthsArr = choices.map(function (choice) {
915
918
  return (choice.label || '').length;
916
919
  });
917
- return (0, _markupUtils.getAdjustedLength)(Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr)));
920
+ return Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
918
921
  });
919
922
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "changeLength", function (event) {
920
923
  var lengthChanged = _this2.props.lengthChanged;
@@ -940,7 +943,7 @@ const require$$20 = _dll_material_ui__core_styles;
940
943
  key: "render",
941
944
  value: function render() {
942
945
  var _this3 = this;
943
- var _this$props2 = this.props, classes = _this$props2.classes, selectChoices = _this$props2.selectChoices, maxLength = _this$props2.maxLength, showMaxLength = _this$props2.showMaxLength, value = _this$props2.value;
946
+ var _this$props2 = this.props, classes = _this$props2.classes, selectChoices = _this$props2.selectChoices, maxLength = _this$props2.maxLength, showMaxLength = _this$props2.showMaxLength, value = _this$props2.value, spellCheck = _this$props2.spellCheck;
944
947
  var choices = this.state.choices;
945
948
  var minLength = this.getChoicesMaxLength();
946
949
  return _react["default"].createElement("div", {
@@ -989,7 +992,8 @@ const require$$20 = _dll_material_ui__core_styles;
989
992
  },
990
993
  onDelete: function onDelete() {
991
994
  return _this3.onRemoveChoice(c);
992
- }
995
+ },
996
+ spellCheck: spellCheck
993
997
  });
994
998
  })));
995
999
  }
@@ -1206,7 +1210,7 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1206
1210
  value: function render() {
1207
1211
  var _this2 = this;
1208
1212
  var choices = this.state.choices;
1209
- var _this$props$model = this.props.model, maxLengthPerChoice = _this$props$model.maxLengthPerChoice, maxLengthPerChoiceEnabled = _this$props$model.maxLengthPerChoiceEnabled;
1213
+ var _this$props2 = this.props, _this$props2$model = _this$props2.model, maxLengthPerChoice = _this$props2$model.maxLengthPerChoice, maxLengthPerChoiceEnabled = _this$props2$model.maxLengthPerChoiceEnabled, spellCheck = _this$props2.spellCheck;
1210
1214
  return _react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
1211
1215
  if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
1212
1216
  var selected = _this2.state.values[key];
@@ -1228,7 +1232,8 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1228
1232
  selectChoices: [selected],
1229
1233
  choices: c,
1230
1234
  maxLength: maxLengthPerChoice[key],
1231
- showMaxLength: maxLengthPerChoiceEnabled
1235
+ showMaxLength: maxLengthPerChoiceEnabled,
1236
+ spellCheck: spellCheck
1232
1237
  });
1233
1238
  }
1234
1239
  }), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && _react["default"].createElement(_alternateSection["default"], {
@@ -1242,7 +1247,8 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1242
1247
  choiceRemoved: function choiceRemoved(value) {
1243
1248
  return _this2.onChoiceRemoved(value);
1244
1249
  },
1245
- selectChoices: this.getRemainingChoices()
1250
+ selectChoices: this.getRemainingChoices(),
1251
+ spellCheck: spellCheck
1246
1252
  }));
1247
1253
  }
1248
1254
  }]);
@@ -1263,10 +1269,12 @@ const require$$10$1 = _dll_react;
1263
1269
  const require$$11$1 = _dll_prop_types;
1264
1270
  const {cloneDeep: require$$12$1} = _dll_lodash;
1265
1271
  const {isEmpty: require$$13$1} = _dll_lodash;
1266
- const require$$16 = _dll_material_ui__core_styles;
1267
- const {Typography: require$$17} = _dll_material_ui__core;
1268
- const require$$14 = _dll_pie_lib__editable_html;
1269
- const require$$15 = _dll_pie_lib__config_ui;
1272
+ const {pick: require$$14} = _dll_lodash;
1273
+ const {throttle: require$$15} = _dll_lodash;
1274
+ const require$$18 = _dll_material_ui__core_styles;
1275
+ const {Typography: require$$19} = _dll_material_ui__core;
1276
+ const require$$16 = _dll_pie_lib__editable_html;
1277
+ const require$$17 = _dll_pie_lib__config_ui;
1270
1278
  (function (exports) {
1271
1279
  var _interopRequireDefault = interopRequireDefault.exports;
1272
1280
  var _typeof$1 = _typeof.exports;
@@ -1286,10 +1294,12 @@ const require$$15 = _dll_pie_lib__config_ui;
1286
1294
  var _propTypes = _interopRequireDefault(require$$11$1);
1287
1295
  var _cloneDeep = _interopRequireDefault(require$$12$1);
1288
1296
  var _isEmpty = _interopRequireDefault(require$$13$1);
1289
- var _editableHtml = _interopRequireWildcard(require$$14);
1290
- var _configUi = require$$15;
1291
- var _styles = require$$16;
1292
- var _Typography = _interopRequireDefault(require$$17);
1297
+ var _pick = _interopRequireDefault(require$$14);
1298
+ var _throttle = _interopRequireDefault(require$$15);
1299
+ var _editableHtml = _interopRequireWildcard(require$$16);
1300
+ var _configUi = require$$17;
1301
+ var _styles = require$$18;
1302
+ var _Typography = _interopRequireDefault(require$$19);
1293
1303
  var _ecrToolbar = _interopRequireDefault(ecrToolbar);
1294
1304
  var _alternateResponses = _interopRequireDefault(alternateResponses);
1295
1305
  var _markupUtils = markupUtils;
@@ -1482,18 +1492,22 @@ const require$$15 = _dll_pie_lib__config_ui;
1482
1492
  });
1483
1493
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeResponse", function (index, newVal) {
1484
1494
  var _this$props3 = _this.props, model = _this$props3.model, onModelChanged = _this$props3.onModelChanged;
1485
- var choices = model.choices, maxLengthPerChoice = model.maxLengthPerChoice;
1486
- var newValLength = (0, _markupUtils.getAdjustedLength)((newVal || '').length);
1495
+ var choices = model.choices;
1496
+ var maxLengthPerChoice = model.maxLengthPerChoice;
1497
+ var newValLength = (newVal || '').length;
1487
1498
  if (!choices[index]) {
1488
1499
  choices[index] = [{
1489
- label: '',
1500
+ label: newVal || '',
1490
1501
  value: '0'
1491
1502
  }];
1492
- maxLengthPerChoice.splice(index, 0, newValLength);
1493
- }
1494
- choices[index][0].label = newVal || '';
1495
- if (maxLengthPerChoice && newVal && maxLengthPerChoice[index] < newValLength) {
1496
- maxLengthPerChoice[index] = newValLength;
1503
+ var nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
1504
+ maxLengthPerChoice = [].concat((0, _toConsumableArray2["default"])(maxLengthPerChoice), (0, _toConsumableArray2["default"])(Array(nbOfMissingChoices).fill(1)));
1505
+ maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
1506
+ } else {
1507
+ choices[index][0].label = newVal || '';
1508
+ if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
1509
+ maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
1510
+ }
1497
1511
  }
1498
1512
  onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
1499
1513
  choices: choices,
@@ -1501,7 +1515,7 @@ const require$$15 = _dll_pie_lib__config_ui;
1501
1515
  }));
1502
1516
  });
1503
1517
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (markup) {
1504
- var _this$props$model = _this.props.model, choices = _this$props$model.choices, maxLengthPerChoice = _this$props$model.maxLengthPerChoice;
1518
+ var _this$props4 = _this.props, _this$props4$model = _this$props4.model, choices = _this$props4$model.choices, maxLengthPerChoice = _this$props4$model.maxLengthPerChoice, onModelChanged = _this$props4.onModelChanged;
1505
1519
  var domMarkup = createElementFromHTML(markup);
1506
1520
  var allRespAreas = domMarkup.querySelectorAll('[data-type="explicit_constructed_response"]');
1507
1521
  var allChoices = {};
@@ -1518,18 +1532,57 @@ const require$$15 = _dll_pie_lib__config_ui;
1518
1532
  allChoices[index] = newChoices;
1519
1533
  el.dataset.index = index;
1520
1534
  });
1521
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
1522
- choices: allChoices,
1523
- slateMarkup: domMarkup.innerHTML,
1524
- maxLengthPerChoice: updatedMaxLengthPerChoice
1525
- }));
1535
+ var callback = function callback() {
1536
+ return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
1537
+ choices: allChoices,
1538
+ slateMarkup: domMarkup.innerHTML,
1539
+ maxLengthPerChoice: updatedMaxLengthPerChoice
1540
+ }));
1541
+ };
1542
+ _this.setState({
1543
+ cachedChoices: undefined
1544
+ }, callback);
1526
1545
  });
1546
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onHandleAreaChange", (0, _throttle["default"])(function (nodes) {
1547
+ var _this$props5 = _this.props, choices = _this$props5.model.choices, onModelChanged = _this$props5.onModelChanged;
1548
+ var cachedChoices = _this.state.cachedChoices;
1549
+ if (!nodes) {
1550
+ return;
1551
+ }
1552
+ var newChoices = choices ? (0, _cloneDeep["default"])(choices) : {};
1553
+ var newCachedChoices = cachedChoices ? (0, _cloneDeep["default"])(cachedChoices) : {};
1554
+ nodes.forEach(function (node) {
1555
+ var keyForNode = node.data.get('index');
1556
+ if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {
1557
+ Object.assign(newChoices, (0, _pick["default"])(newCachedChoices, keyForNode));
1558
+ if (newCachedChoices.hasOwnProperty(keyForNode)) {
1559
+ delete newCachedChoices[keyForNode];
1560
+ }
1561
+ } else {
1562
+ Object.assign(newCachedChoices, (0, _pick["default"])(newChoices, keyForNode));
1563
+ if (newChoices.hasOwnProperty(keyForNode)) {
1564
+ delete newChoices[keyForNode];
1565
+ }
1566
+ }
1567
+ });
1568
+ var callback = function callback() {
1569
+ return onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
1570
+ choices: newChoices
1571
+ }));
1572
+ };
1573
+ _this.setState({
1574
+ cachedChoices: newCachedChoices
1575
+ }, callback);
1576
+ }, 500, {
1577
+ trailing: false,
1578
+ leading: true
1579
+ }));
1527
1580
  return _this;
1528
1581
  }
1529
1582
  (0, _createClass2["default"])(Main, [{
1530
1583
  key: "componentDidMount",
1531
1584
  value: function componentDidMount() {
1532
- var _this$props4 = this.props, _this$props4$model = _this$props4.model, slateMarkup = _this$props4$model.slateMarkup, choices = _this$props4$model.choices, _this$props4$model$ma = _this$props4$model.maxLengthPerChoice, maxLengthPerChoice = _this$props4$model$ma === void 0 ? [] : _this$props4$model$ma, onModelChanged = _this$props4.onModelChanged;
1585
+ var _this$props6 = this.props, _this$props6$model = _this$props6.model, slateMarkup = _this$props6$model.slateMarkup, choices = _this$props6$model.choices, _this$props6$model$ma = _this$props6$model.maxLengthPerChoice, maxLengthPerChoice = _this$props6$model$ma === void 0 ? [] : _this$props6$model$ma, onModelChanged = _this$props6.onModelChanged;
1533
1586
  var undefinedLengths = !maxLengthPerChoice.length;
1534
1587
  this.setState({
1535
1588
  markup: slateMarkup
@@ -1538,9 +1591,9 @@ const require$$15 = _dll_pie_lib__config_ui;
1538
1591
  var labelLengthsArr = (choice || []).map(function (choice) {
1539
1592
  return (choice.label || '').length;
1540
1593
  });
1541
- var length = (0, _markupUtils.getAdjustedLength)(Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr)));
1542
- if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length) {
1543
- maxLengthPerChoice[index] = length;
1594
+ var length = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
1595
+ if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length || maxLengthPerChoice[index] > length + 10) {
1596
+ maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(length);
1544
1597
  }
1545
1598
  });
1546
1599
  onModelChanged(_objectSpread(_objectSpread({}, this.props.model), {}, {
@@ -1551,9 +1604,9 @@ const require$$15 = _dll_pie_lib__config_ui;
1551
1604
  key: "render",
1552
1605
  value: function render() {
1553
1606
  var _this2 = this;
1554
- var _this$props5 = this.props, classes = _this$props5.classes, model = _this$props5.model, configuration = _this$props5.configuration, onConfigurationChanged = _this$props5.onConfigurationChanged, imageSupport = _this$props5.imageSupport;
1555
- var _ref = configuration || ({}), _ref$prompt = _ref.prompt, prompt = _ref$prompt === void 0 ? {} : _ref$prompt, _ref$partialScoring = _ref.partialScoring, partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring, _ref$rationale = _ref.rationale, rationale = _ref$rationale === void 0 ? {} : _ref$rationale, _ref$teacherInstructi = _ref.teacherInstructions, teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi, _ref$maxLengthPerChoi = _ref.maxLengthPerChoice, maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi;
1556
- var _ref2 = model || ({}), teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled, promptEnabled = _ref2.promptEnabled, rationaleEnabled = _ref2.rationaleEnabled, maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled;
1607
+ var _this$props7 = this.props, classes = _this$props7.classes, model = _this$props7.model, configuration = _this$props7.configuration, onConfigurationChanged = _this$props7.onConfigurationChanged, imageSupport = _this$props7.imageSupport;
1608
+ var _ref = configuration || ({}), _ref$prompt = _ref.prompt, prompt = _ref$prompt === void 0 ? {} : _ref$prompt, _ref$partialScoring = _ref.partialScoring, partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring, _ref$rationale = _ref.rationale, rationale = _ref$rationale === void 0 ? {} : _ref$rationale, _ref$teacherInstructi = _ref.teacherInstructions, teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi, _ref$maxLengthPerChoi = _ref.maxLengthPerChoice, maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi, _ref$spellCheck = _ref.spellCheck, spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
1609
+ var _ref2 = model || ({}), teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled, promptEnabled = _ref2.promptEnabled, rationaleEnabled = _ref2.rationaleEnabled, maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled, spellCheckEnabled = _ref2.spellCheckEnabled;
1557
1610
  var toolbarOpts = {};
1558
1611
  switch (model.toolbarEditorPosition) {
1559
1612
  case 'top':
@@ -1583,7 +1636,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1583
1636
  Properties: {
1584
1637
  teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
1585
1638
  rationaleEnabled: rationale.settings && toggle(rationale.label),
1586
- promptEnabled: prompt.settings && toggle(prompt.label)
1639
+ promptEnabled: prompt.settings && toggle(prompt.label),
1640
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label)
1587
1641
  }
1588
1642
  }
1589
1643
  })
@@ -1596,7 +1650,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1596
1650
  onChange: this.onTeacherInstructionsChanged,
1597
1651
  imageSupport: imageSupport,
1598
1652
  nonEmpty: false,
1599
- toolbarOpts: toolbarOpts
1653
+ toolbarOpts: toolbarOpts,
1654
+ spellCheck: spellCheckEnabled
1600
1655
  })), promptEnabled && _react["default"].createElement(_configUi.InputContainer, {
1601
1656
  label: prompt.label,
1602
1657
  className: classes.promptHolder
@@ -1607,7 +1662,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1607
1662
  imageSupport: imageSupport,
1608
1663
  nonEmpty: false,
1609
1664
  disableUnderline: true,
1610
- toolbarOpts: toolbarOpts
1665
+ toolbarOpts: toolbarOpts,
1666
+ spellCheck: spellCheckEnabled
1611
1667
  })), _react["default"].createElement(_Typography["default"], {
1612
1668
  className: classes.text
1613
1669
  }, "Define Template, Choices, and Correct Responses"), _react["default"].createElement(_editableHtml["default"], {
@@ -1615,6 +1671,7 @@ const require$$15 = _dll_pie_lib__config_ui;
1615
1671
  toolbarOpts: {
1616
1672
  position: 'top'
1617
1673
  },
1674
+ spellCheck: spellCheckEnabled,
1618
1675
  responseAreaProps: {
1619
1676
  type: 'explicit-constructed-response',
1620
1677
  options: {
@@ -1634,7 +1691,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1634
1691
  correctChoice: correctChoice
1635
1692
  });
1636
1693
  };
1637
- }
1694
+ },
1695
+ onHandleAreaChange: this.onHandleAreaChange
1638
1696
  },
1639
1697
  className: classes.markup,
1640
1698
  markup: model.slateMarkup,
@@ -1649,7 +1707,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1649
1707
  model: model,
1650
1708
  onChange: this.onResponsesChanged,
1651
1709
  onLengthChange: this.onLengthChanged,
1652
- maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled
1710
+ maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
1711
+ spellCheck: spellCheckEnabled
1653
1712
  }), rationaleEnabled && _react["default"].createElement(_configUi.InputContainer, {
1654
1713
  label: rationale.label,
1655
1714
  className: classes.promptHolder
@@ -1658,7 +1717,8 @@ const require$$15 = _dll_pie_lib__config_ui;
1658
1717
  markup: model.rationale || '',
1659
1718
  onChange: this.onRationaleChanged,
1660
1719
  imageSupport: imageSupport,
1661
- toolbarOpts: toolbarOpts
1720
+ toolbarOpts: toolbarOpts,
1721
+ spellCheck: spellCheckEnabled
1662
1722
  })))));
1663
1723
  }
1664
1724
  }]);
@@ -1697,6 +1757,7 @@ var defaults = {};
1697
1757
  markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',
1698
1758
  toolbarEditorPosition: 'bottom',
1699
1759
  displayType: 'block',
1760
+ spellCheckEnabled: false,
1700
1761
  choices: {
1701
1762
  0: [{
1702
1763
  label: 'cow',
@@ -1749,6 +1810,11 @@ var defaults = {};
1749
1810
  settings: true,
1750
1811
  label: 'Rationale'
1751
1812
  },
1813
+ spellCheck: {
1814
+ label: "Spellcheck",
1815
+ settings: true,
1816
+ enabled: true
1817
+ },
1752
1818
  teacherInstructions: {
1753
1819
  settings: true,
1754
1820
  label: 'Teacher Instructions'
@@ -21223,10 +21223,15 @@ function model(question, session, env) {
21223
21223
  // calculate maxLengthPerChoice array if it is not defined or defined incorrectly
21224
21224
  Object.values(choices).forEach((choice, index) => {
21225
21225
  const labelLengthsArr = (choice || []).map(choice => (choice.label || '').length);
21226
- const length = getAdjustedLength(Math.max(...labelLengthsArr));
21227
-
21228
- if (undefinedLengths || !maxLengthPerChoice[index] || maxLengthPerChoice[index] < length) {
21229
- maxLengthPerChoice[index] = length;
21226
+ const length = Math.max(...labelLengthsArr);
21227
+
21228
+ if (
21229
+ undefinedLengths
21230
+ || !maxLengthPerChoice[index]
21231
+ || maxLengthPerChoice[index] < length
21232
+ || maxLengthPerChoice[index] > length + 10
21233
+ ) {
21234
+ maxLengthPerChoice[index] = getAdjustedLength(length);
21230
21235
  }
21231
21236
  });
21232
21237
 
package/module/demo.js CHANGED
@@ -18,7 +18,7 @@ generate.model = (id, element) => ({
18
18
  1: [choice('over', '0'), choice('past', '1'), choice('beyond', '2')],
19
19
  2: [choice('moon', '0')]
20
20
  },
21
- maxLengthPerChoice: [10, 11, 7],
21
+ maxLengthPerChoice: [7, 10, 4],
22
22
  prompt: 'Complete the sentence',
23
23
  note: 'The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
24
24
  promptEnabled: true,
package/module/element.js CHANGED
@@ -1,6 +1,6 @@
1
- import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.3.1/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.24/module/index.js";
3
- import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.22/module/index.js";
1
+ import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.4.8/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.33/module/index.js";
3
+ import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.31/module/index.js";
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
  var lib$1 = {};
6
6
  Object.defineProperty(lib$1, "__esModule", {
@@ -12976,6 +12976,12 @@ const rules = [marks, {
12976
12976
  ...normalAttrs
12977
12977
  });
12978
12978
  const object = getObject(type);
12979
+ if (el.tagName.toLowerCase() === 'math') {
12980
+ return {
12981
+ isMath: true,
12982
+ nodes: [el]
12983
+ };
12984
+ }
12979
12985
  return {
12980
12986
  object,
12981
12987
  type,
@@ -13040,6 +13046,19 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13040
13046
  const children = [];
13041
13047
  (layout.nodes || []).forEach((n, index) => {
13042
13048
  const key = `${n.type}-${index}`;
13049
+ if (n.isMath) {
13050
+ children.push(React$c.createElement('span', {
13051
+ dangerouslySetInnerHTML: {
13052
+ __html: `<math>${n.nodes[0].innerHTML}</math>`
13053
+ },
13054
+ __self: undefined,
13055
+ __source: {
13056
+ fileName: _jsxFileName$b,
13057
+ lineNumber: 49
13058
+ }
13059
+ }));
13060
+ return children;
13061
+ }
13043
13062
  if (rootRenderChildren) {
13044
13063
  const c = rootRenderChildren(n, value, onChange);
13045
13064
  if (c) {
@@ -13063,7 +13082,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13063
13082
  __self: undefined,
13064
13083
  __source: {
13065
13084
  fileName: _jsxFileName$b,
13066
- lineNumber: 70
13085
+ lineNumber: 77
13067
13086
  }
13068
13087
  }, content));
13069
13088
  break;
@@ -13080,7 +13099,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13080
13099
  __self: undefined,
13081
13100
  __source: {
13082
13101
  fileName: _jsxFileName$b,
13083
- lineNumber: 80
13102
+ lineNumber: 87
13084
13103
  }
13085
13104
  }, subNodes));
13086
13105
  } else {
@@ -13092,7 +13111,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13092
13111
  __self: undefined,
13093
13112
  __source: {
13094
13113
  fileName: _jsxFileName$b,
13095
- lineNumber: 85
13114
+ lineNumber: 92
13096
13115
  }
13097
13116
  }, subNodes));
13098
13117
  } else {
@@ -13102,7 +13121,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13102
13121
  __self: undefined,
13103
13122
  __source: {
13104
13123
  fileName: _jsxFileName$b,
13105
- lineNumber: 90
13124
+ lineNumber: 97
13106
13125
  }
13107
13126
  }));
13108
13127
  }
@@ -13113,14 +13132,14 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13113
13132
  };
13114
13133
  const MaskContainer = withStyles$5(() => ({
13115
13134
  main: {
13116
- display: 'inherit'
13135
+ display: 'initial'
13117
13136
  }
13118
13137
  }))(props => React$c.createElement('div', {
13119
13138
  className: props.classes.main,
13120
13139
  __self: undefined,
13121
13140
  __source: {
13122
13141
  fileName: _jsxFileName$b,
13123
- lineNumber: 102
13142
+ lineNumber: 109
13124
13143
  }
13125
13144
  }, props.children));
13126
13145
  class Mask extends React$c.Component {
@@ -13152,7 +13171,7 @@ class Mask extends React$c.Component {
13152
13171
  __self: this,
13153
13172
  __source: {
13154
13173
  fileName: _jsxFileName$b,
13155
- lineNumber: 124
13174
+ lineNumber: 131
13156
13175
  }
13157
13176
  }, children);
13158
13177
  }
@@ -13402,6 +13421,7 @@ const useStyles = withStyles$3(() => ({
13402
13421
  minWidth: '90px',
13403
13422
  fontSize: 'inherit',
13404
13423
  minHeight: '32px',
13424
+ height: 'auto',
13405
13425
  maxWidth: '374px',
13406
13426
  position: 'relative'
13407
13427
  },
@@ -13490,7 +13510,7 @@ class BlankContent extends React$8.Component {
13490
13510
  __self: this,
13491
13511
  __source: {
13492
13512
  fileName: _jsxFileName$7,
13493
- lineNumber: 115
13513
+ lineNumber: 116
13494
13514
  }
13495
13515
  }, React$8.createElement('span', {
13496
13516
  className: classnames$1(classes.chipLabel, isOver && classes.over, {
@@ -13506,7 +13526,7 @@ class BlankContent extends React$8.Component {
13506
13526
  __self: this,
13507
13527
  __source: {
13508
13528
  fileName: _jsxFileName$7,
13509
- lineNumber: 116
13529
+ lineNumber: 117
13510
13530
  }
13511
13531
  }, ' '), draggedLabel && React$8.createElement('span', {
13512
13532
  className: classnames$1(classes.chipLabel, isOver && classes.over, classes.dragged),
@@ -13520,7 +13540,7 @@ class BlankContent extends React$8.Component {
13520
13540
  __self: this,
13521
13541
  __source: {
13522
13542
  fileName: _jsxFileName$7,
13523
- lineNumber: 132
13543
+ lineNumber: 133
13524
13544
  }
13525
13545
  }, ' ')),
13526
13546
  className: classnames$1(classes.chip, isOver && classes.over, {
@@ -13539,7 +13559,7 @@ class BlankContent extends React$8.Component {
13539
13559
  __self: this,
13540
13560
  __source: {
13541
13561
  fileName: _jsxFileName$7,
13542
- lineNumber: 108
13562
+ lineNumber: 109
13543
13563
  }
13544
13564
  });
13545
13565
  }
@@ -13553,14 +13573,14 @@ const connectedBlankContent = useStyles(({connectDragSource, connectDropTarget,
13553
13573
  __self: undefined,
13554
13574
  __source: {
13555
13575
  fileName: _jsxFileName$7,
13556
- lineNumber: 171
13576
+ lineNumber: 172
13557
13577
  }
13558
13578
  }, React$8.createElement(StyledBlankContent, {
13559
13579
  ...props,
13560
13580
  __self: undefined,
13561
13581
  __source: {
13562
13582
  fileName: _jsxFileName$7,
13563
- lineNumber: 172
13583
+ lineNumber: 173
13564
13584
  }
13565
13585
  }))));
13566
13586
  });
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/explicit-constructed-response@3.12.1</title>
5
+ <title>@pie-element/explicit-constructed-response@3.12.4</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response",
3
- "version": "3.12.1",
3
+ "version": "3.12.4",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^1.3.1"
7
+ "version": "^1.4.8"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^1.0.24"
11
+ "version": "^1.0.33"
12
12
  },
13
13
  {
14
14
  "name": "@pie-lib/drag-module",
15
- "version": "^1.0.22"
15
+ "version": "^1.0.31"
16
16
  }
17
17
  ]
18
18
  }
@@ -16,7 +16,7 @@ generate.model = (id, element) => ({
16
16
  1: [choice('over', '0'), choice('past', '1'), choice('beyond', '2')],
17
17
  2: [choice('moon', '0')]
18
18
  },
19
- maxLengthPerChoice: [10, 11, 7],
19
+ maxLengthPerChoice: [7, 10, 4],
20
20
  prompt: 'Complete the sentence',
21
21
  note: 'The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
22
22
  promptEnabled: true,
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/explicit-constructed-response@3.12.1</title>
5
+ <title>@pie-element/explicit-constructed-response@3.12.4</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"