@pie-element/explicit-constructed-response 9.3.4-next.0 → 10.0.0-beta.0

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