@pie-element/inline-dropdown 10.1.1 → 10.1.2-next.1
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.
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaults.d.ts +194 -0
- package/dist/author/defaults.js +130 -0
- package/dist/author/index.d.ts +43 -0
- package/dist/author/index.js +83 -0
- package/dist/author/inline-dropdown-toolbar.d.ts +48 -0
- package/dist/author/inline-dropdown-toolbar.js +268 -0
- package/dist/author/main.d.ts +49 -0
- package/dist/author/main.js +379 -0
- package/dist/author/markupUtils.d.ts +12 -0
- package/dist/author/markupUtils.js +23 -0
- package/dist/author/response-area.d.ts +20 -0
- package/dist/author/response-area.js +32 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.js +10 -0
- package/dist/browser/Close-CMvmRhfL.js +9024 -0
- package/dist/browser/Close-CMvmRhfL.js.map +1 -0
- package/dist/browser/author/index.js +40578 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +196 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2714 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-CAsDMEWi.js +133 -0
- package/dist/browser/dist-CAsDMEWi.js.map +1 -0
- package/dist/browser/inline-dropdown.css +2 -0
- package/dist/controller/defaults.d.ts +27 -0
- package/dist/controller/defaults.js +21 -0
- package/dist/controller/index.d.ts +54 -0
- package/dist/controller/index.js +124 -0
- package/dist/controller/utils.d.ts +12 -0
- package/dist/controller/utils.js +13 -0
- package/dist/delivery/index.d.ts +20 -0
- package/dist/delivery/index.js +60 -0
- package/dist/delivery/inline-dropdown.d.ts +38 -0
- package/dist/delivery/inline-dropdown.js +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +148 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +86 -21
- package/CHANGELOG.json +0 -1082
- package/CHANGELOG.md +0 -2185
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -647
- package/configure/CHANGELOG.md +0 -1942
- package/configure/lib/defaults.js +0 -192
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -135
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/inline-dropdown-toolbar.js +0 -457
- package/configure/lib/inline-dropdown-toolbar.js.map +0 -1
- package/configure/lib/main.js +0 -603
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/markupUtils.js +0 -50
- package/configure/lib/markupUtils.js.map +0 -1
- package/configure/lib/response-area.js +0 -48
- package/configure/lib/response-area.js.map +0 -1
- package/configure/lib/utils.js +0 -22
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -24
- package/controller/CHANGELOG.json +0 -467
- package/controller/CHANGELOG.md +0 -1283
- package/controller/lib/defaults.js +0 -25
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -295
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -32
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -16
- package/docs/config-schema.json +0 -2854
- package/docs/config-schema.json.md +0 -2106
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -76
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -11
- package/docs/pie-schema.json +0 -1152
- package/docs/pie-schema.json.md +0 -814
- package/lib/index.js +0 -85
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -176
- package/lib/inline-dropdown.js.map +0 -1
package/configure/lib/main.js
DELETED
|
@@ -1,603 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.Main = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _editableHtmlTipTap = _interopRequireWildcard(require("@pie-lib/editable-html-tip-tap"));
|
|
14
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
15
|
-
var _mathRendering = require("@pie-lib/math-rendering");
|
|
16
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
17
|
-
var _lodashEs = require("lodash-es");
|
|
18
|
-
var _styles = require("@mui/material/styles");
|
|
19
|
-
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
20
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
21
|
-
var _Accordion = _interopRequireDefault(require("@mui/material/Accordion"));
|
|
22
|
-
var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
|
|
23
|
-
var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
|
|
24
|
-
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
25
|
-
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
26
|
-
var _inlineDropdownToolbar = _interopRequireDefault(require("./inline-dropdown-toolbar"));
|
|
27
|
-
var _utils = require("./utils");
|
|
28
|
-
var _responseArea = _interopRequireDefault(require("./response-area"));
|
|
29
|
-
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); }
|
|
30
|
-
const {
|
|
31
|
-
toggle,
|
|
32
|
-
Panel,
|
|
33
|
-
dropdown
|
|
34
|
-
} = _configUi.settings;
|
|
35
|
-
const PromptHolder = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
36
|
-
theme
|
|
37
|
-
}) => ({
|
|
38
|
-
width: '100%',
|
|
39
|
-
paddingTop: theme.spacing(2),
|
|
40
|
-
marginBottom: theme.spacing(2)
|
|
41
|
-
}));
|
|
42
|
-
const ChoiceRationaleHolder = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
43
|
-
theme
|
|
44
|
-
}) => ({
|
|
45
|
-
width: '100%',
|
|
46
|
-
paddingTop: theme.spacing(0.5),
|
|
47
|
-
marginBottom: theme.spacing(2)
|
|
48
|
-
}));
|
|
49
|
-
const StyledTypography = (0, _styles.styled)(_Typography.default)(({
|
|
50
|
-
theme
|
|
51
|
-
}) => ({
|
|
52
|
-
fontSize: theme.typography.fontSize + 2,
|
|
53
|
-
marginRight: theme.spacing(1)
|
|
54
|
-
}));
|
|
55
|
-
const RationaleLabel = (0, _styles.styled)('span')(({
|
|
56
|
-
theme
|
|
57
|
-
}) => ({
|
|
58
|
-
display: 'flex',
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
whiteSpace: 'break-spaces',
|
|
61
|
-
color: _renderUi.color.disabled(),
|
|
62
|
-
padding: 0,
|
|
63
|
-
fontSize: theme.typography.fontSize - 2,
|
|
64
|
-
lineHeight: 1
|
|
65
|
-
}));
|
|
66
|
-
const RationaleChoices = (0, _styles.styled)('div')(({
|
|
67
|
-
theme
|
|
68
|
-
}) => ({
|
|
69
|
-
marginBottom: theme.spacing(2.5)
|
|
70
|
-
}));
|
|
71
|
-
const StyledAccordionDetails = (0, _styles.styled)(_AccordionDetails.default)({
|
|
72
|
-
display: 'block',
|
|
73
|
-
paddingTop: 0,
|
|
74
|
-
paddingBottom: 0
|
|
75
|
-
});
|
|
76
|
-
const FlexContainer = (0, _styles.styled)('div')(({
|
|
77
|
-
theme
|
|
78
|
-
}) => ({
|
|
79
|
-
display: 'flex',
|
|
80
|
-
alignItems: 'center',
|
|
81
|
-
marginBottom: theme.spacing(1)
|
|
82
|
-
}));
|
|
83
|
-
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
84
|
-
theme
|
|
85
|
-
}) => ({
|
|
86
|
-
'& .MuiTooltip-tooltip': {
|
|
87
|
-
fontSize: theme.typography.fontSize - 2,
|
|
88
|
-
whiteSpace: 'pre',
|
|
89
|
-
maxWidth: '500px'
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
const ErrorText = (0, _styles.styled)('div')(({
|
|
93
|
-
theme
|
|
94
|
-
}) => ({
|
|
95
|
-
fontSize: theme.typography.fontSize - 2,
|
|
96
|
-
color: theme.palette.error.main,
|
|
97
|
-
paddingTop: theme.spacing(1)
|
|
98
|
-
}));
|
|
99
|
-
const createElementFromHTML = htmlString => {
|
|
100
|
-
const div = document.createElement('div');
|
|
101
|
-
div.innerHTML = (htmlString || '').trim();
|
|
102
|
-
return div;
|
|
103
|
-
};
|
|
104
|
-
class Main extends _react.default.Component {
|
|
105
|
-
constructor(...args) {
|
|
106
|
-
super(...args);
|
|
107
|
-
(0, _defineProperty2.default)(this, "state", {
|
|
108
|
-
warning: {
|
|
109
|
-
open: false
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
(0, _defineProperty2.default)(this, "onModelChange", newVal => {
|
|
113
|
-
this.props.onModelChanged({
|
|
114
|
-
...this.props.model,
|
|
115
|
-
...newVal
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
119
|
-
this.onModelChange({
|
|
120
|
-
prompt
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
(0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
|
|
124
|
-
this.onModelChange({
|
|
125
|
-
rationale
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
(0, _defineProperty2.default)(this, "onChoiceRationaleChanged", (index, choice) => {
|
|
129
|
-
const {
|
|
130
|
-
model
|
|
131
|
-
} = this.props;
|
|
132
|
-
const indexOfChoice = model.choices && model.choices[index] && model.choices[index].findIndex(elem => elem.label === choice.label && elem.value === choice.value);
|
|
133
|
-
model.choices[index] && model.choices[index].splice(indexOfChoice, 1, choice);
|
|
134
|
-
this.onModelChange(model);
|
|
135
|
-
});
|
|
136
|
-
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
137
|
-
this.onModelChange({
|
|
138
|
-
teacherInstructions
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
(0, _defineProperty2.default)(this, "onMarkupChanged", slateMarkup => {
|
|
142
|
-
this.onModelChange({
|
|
143
|
-
slateMarkup
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
(0, _defineProperty2.default)(this, "onCheck", callback => {
|
|
147
|
-
this.setState({
|
|
148
|
-
warning: {
|
|
149
|
-
open: true,
|
|
150
|
-
text: 'Response areas with under 2 options or with no correct answers will be discarded.',
|
|
151
|
-
onClose: () => {
|
|
152
|
-
this.setState({
|
|
153
|
-
warning: {
|
|
154
|
-
open: false
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
onConfirm: () => {
|
|
159
|
-
this.setState({
|
|
160
|
-
warning: {
|
|
161
|
-
open: false
|
|
162
|
-
}
|
|
163
|
-
}, callback);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
(0, _defineProperty2.default)(this, "onChange", markup => {
|
|
169
|
-
const {
|
|
170
|
-
respAreaChoices
|
|
171
|
-
} = this.state;
|
|
172
|
-
const domMarkup = createElementFromHTML(markup);
|
|
173
|
-
const allRespAreas = domMarkup.querySelectorAll('[data-type="inline_dropdown"]');
|
|
174
|
-
const allChoices = {};
|
|
175
|
-
allRespAreas.forEach(el => {
|
|
176
|
-
allChoices[el.dataset.index] = el.dataset.value || '';
|
|
177
|
-
});
|
|
178
|
-
const existingRespAreaChoices = (0, _lodashEs.reduce)(respAreaChoices, (obj, choices, key) => {
|
|
179
|
-
if (!(0, _lodashEs.isUndefined)(allChoices[key])) {
|
|
180
|
-
obj[key] = respAreaChoices[key];
|
|
181
|
-
}
|
|
182
|
-
return obj;
|
|
183
|
-
}, {});
|
|
184
|
-
const newRespAreaChoices = {};
|
|
185
|
-
let shouldWarn = false;
|
|
186
|
-
allRespAreas.forEach((el, index) => {
|
|
187
|
-
const newChoices = existingRespAreaChoices[el.dataset.index] || [];
|
|
188
|
-
if (newChoices.length < 2 || !newChoices.find(c => c.correct)) {
|
|
189
|
-
el.remove();
|
|
190
|
-
shouldWarn = true;
|
|
191
|
-
} else {
|
|
192
|
-
newRespAreaChoices[index] = existingRespAreaChoices[el.dataset.index] || [];
|
|
193
|
-
el.dataset.index = index;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
if (shouldWarn) {
|
|
197
|
-
this.onCheck(() => this.onModelChange({
|
|
198
|
-
choices: (0, _lodashEs.cloneDeep)(newRespAreaChoices),
|
|
199
|
-
slateMarkup: domMarkup.innerHTML
|
|
200
|
-
}));
|
|
201
|
-
} else {
|
|
202
|
-
this.onModelChange({
|
|
203
|
-
choices: (0, _lodashEs.cloneDeep)(newRespAreaChoices),
|
|
204
|
-
slateMarkup: domMarkup.innerHTML
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
(0, _defineProperty2.default)(this, "onAddChoice", (index, label, choiceIndex) => {
|
|
209
|
-
const {
|
|
210
|
-
respAreaChoices
|
|
211
|
-
} = this.state;
|
|
212
|
-
const {
|
|
213
|
-
maxResponseAreaChoices
|
|
214
|
-
} = this.props.configuration;
|
|
215
|
-
const showWarning = message => this.setState({
|
|
216
|
-
warning: {
|
|
217
|
-
open: true,
|
|
218
|
-
text: message,
|
|
219
|
-
onClose: undefined,
|
|
220
|
-
onConfirm: () => {
|
|
221
|
-
this.setState({
|
|
222
|
-
warning: {
|
|
223
|
-
open: false
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
if (respAreaChoices[index] && respAreaChoices[index].length >= maxResponseAreaChoices) {
|
|
230
|
-
showWarning(`There are only ${maxResponseAreaChoices} answers allowed per choice.`);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (!respAreaChoices[index]) {
|
|
234
|
-
respAreaChoices[index] = [];
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// check for duplicate answer, but exclude the one that is currently edited
|
|
238
|
-
if ((respAreaChoices[index] || []).find((r, idx) => r.label === label && idx !== choiceIndex)) {
|
|
239
|
-
showWarning('Duplicate answers are not allowed.');
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (choiceIndex >= 0 && respAreaChoices[index]?.[choiceIndex]) {
|
|
243
|
-
// we need to update the choice label with the new value
|
|
244
|
-
respAreaChoices[index][choiceIndex].label = label;
|
|
245
|
-
} else {
|
|
246
|
-
// add a new choice
|
|
247
|
-
const value = respAreaChoices[index] && (0, _lodashEs.max)(respAreaChoices[index].map(c => parseInt(c.value)).filter(val => !isNaN(val))) || 0;
|
|
248
|
-
respAreaChoices[index].push({
|
|
249
|
-
label,
|
|
250
|
-
value: `${value + 1}`,
|
|
251
|
-
correct: false
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
this.onModelChange({
|
|
255
|
-
choices: (0, _lodashEs.cloneDeep)(respAreaChoices)
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
(0, _defineProperty2.default)(this, "onRemoveChoice", (respIndex, index) => {
|
|
259
|
-
const {
|
|
260
|
-
respAreaChoices
|
|
261
|
-
} = this.state;
|
|
262
|
-
respAreaChoices[respIndex].splice(index, 1);
|
|
263
|
-
this.onModelChange({
|
|
264
|
-
choices: (0, _lodashEs.cloneDeep)(respAreaChoices)
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
(0, _defineProperty2.default)(this, "onSelectChoice", (respIndex, selectedIndex) => {
|
|
268
|
-
const {
|
|
269
|
-
respAreaChoices
|
|
270
|
-
} = this.state;
|
|
271
|
-
respAreaChoices[respIndex] = respAreaChoices[respIndex].map((choice, index) => ({
|
|
272
|
-
...choice,
|
|
273
|
-
correct: index === selectedIndex
|
|
274
|
-
}));
|
|
275
|
-
this.onModelChange({
|
|
276
|
-
choices: (0, _lodashEs.cloneDeep)(respAreaChoices)
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
componentDidMount() {
|
|
281
|
-
const {
|
|
282
|
-
model: {
|
|
283
|
-
choices
|
|
284
|
-
}
|
|
285
|
-
} = this.props;
|
|
286
|
-
this.setState({
|
|
287
|
-
respAreaChoices: (0, _lodashEs.cloneDeep)(choices)
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
UNSAFE_componentWillReceiveProps(nProps) {
|
|
291
|
-
const newState = {};
|
|
292
|
-
if (!(0, _lodashEs.isEqual)(nProps.model.choices, this.props.model.choices) || !(0, _lodashEs.isEqual)(nProps.model.choices, this.state.respAreaChoices)) {
|
|
293
|
-
newState.respAreaChoices = (0, _lodashEs.cloneDeep)(nProps.model.choices);
|
|
294
|
-
}
|
|
295
|
-
if (!(0, _lodashEs.isEmpty)(newState)) {
|
|
296
|
-
this.setState(newState);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
componentDidUpdate() {
|
|
300
|
-
//eslint-disable-next-line
|
|
301
|
-
const domNode = _reactDom.default.findDOMNode(this);
|
|
302
|
-
(0, _mathRendering.renderMath)(domNode);
|
|
303
|
-
}
|
|
304
|
-
render() {
|
|
305
|
-
const {
|
|
306
|
-
warning
|
|
307
|
-
} = this.state;
|
|
308
|
-
const {
|
|
309
|
-
model,
|
|
310
|
-
configuration,
|
|
311
|
-
onConfigurationChanged,
|
|
312
|
-
imageSupport,
|
|
313
|
-
uploadSoundSupport
|
|
314
|
-
} = this.props;
|
|
315
|
-
const {
|
|
316
|
-
baseInputConfiguration = {},
|
|
317
|
-
choiceRationale = {},
|
|
318
|
-
contentDimensions = {},
|
|
319
|
-
lockChoiceOrder = {},
|
|
320
|
-
maxResponseAreas,
|
|
321
|
-
maxImageWidth = {},
|
|
322
|
-
maxImageHeight = {},
|
|
323
|
-
partialScoring = {},
|
|
324
|
-
prompt = {},
|
|
325
|
-
rationale = {},
|
|
326
|
-
settingsPanelDisabled,
|
|
327
|
-
spellCheck = {},
|
|
328
|
-
teacherInstructions = {},
|
|
329
|
-
template = {},
|
|
330
|
-
withRubric = {},
|
|
331
|
-
mathMlOptions = {},
|
|
332
|
-
language = {},
|
|
333
|
-
languageChoices = {},
|
|
334
|
-
responseAreaInputConfiguration = {}
|
|
335
|
-
} = configuration || {};
|
|
336
|
-
const {
|
|
337
|
-
choiceRationaleEnabled,
|
|
338
|
-
choices,
|
|
339
|
-
errors,
|
|
340
|
-
extraCSSRules,
|
|
341
|
-
promptEnabled,
|
|
342
|
-
rationaleEnabled,
|
|
343
|
-
spellCheckEnabled,
|
|
344
|
-
teacherInstructionsEnabled,
|
|
345
|
-
toolbarEditorPosition
|
|
346
|
-
} = model || {};
|
|
347
|
-
const {
|
|
348
|
-
prompt: promptError,
|
|
349
|
-
rationale: rationaleError,
|
|
350
|
-
responseAreasError,
|
|
351
|
-
responseAreaChoicesError,
|
|
352
|
-
teacherInstructions: teacherInstructionsError
|
|
353
|
-
} = errors || {};
|
|
354
|
-
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
355
|
-
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
356
|
-
const renderChoiceRationale = () => (Object.keys(choices) || []).map((key, index) => /*#__PURE__*/_react.default.createElement(RationaleChoices, {
|
|
357
|
-
key: key
|
|
358
|
-
}, /*#__PURE__*/_react.default.createElement(_Accordion.default, {
|
|
359
|
-
slotProps: {
|
|
360
|
-
transition: {
|
|
361
|
-
timeout: {
|
|
362
|
-
enter: 225,
|
|
363
|
-
exit: 195
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}, /*#__PURE__*/_react.default.createElement(_AccordionSummary.default, {
|
|
368
|
-
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null)
|
|
369
|
-
}, /*#__PURE__*/_react.default.createElement(StyledTypography, {
|
|
370
|
-
component: 'div'
|
|
371
|
-
}, `Rationale for response area #${index + 1}`)), /*#__PURE__*/_react.default.createElement(StyledAccordionDetails, null, (choices[key] || []).map(choice => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
372
|
-
key: choice.label
|
|
373
|
-
}, /*#__PURE__*/_react.default.createElement(RationaleLabel, {
|
|
374
|
-
dangerouslySetInnerHTML: {
|
|
375
|
-
__html: `${rationale.label} for ${choice.label} (${choice.correct ? 'correct' : 'incorrect'})`
|
|
376
|
-
}
|
|
377
|
-
}), /*#__PURE__*/_react.default.createElement(ChoiceRationaleHolder, null, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
378
|
-
markup: choice.rationale || '',
|
|
379
|
-
spellCheck: spellCheckEnabled,
|
|
380
|
-
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
381
|
-
onChange: c => this.onChoiceRationaleChanged(key, {
|
|
382
|
-
...choice,
|
|
383
|
-
rationale: c
|
|
384
|
-
}),
|
|
385
|
-
imageSupport: imageSupport,
|
|
386
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
387
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
388
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
389
|
-
mathMlOptions: mathMlOptions
|
|
390
|
-
}))))))));
|
|
391
|
-
const toolbarOpts = {
|
|
392
|
-
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
393
|
-
};
|
|
394
|
-
const validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
395
|
-
const panelSettings = {
|
|
396
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
397
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
398
|
-
'language.enabled': language.settings && toggle(language.label, true),
|
|
399
|
-
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
400
|
-
};
|
|
401
|
-
const panelProperties = {
|
|
402
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
403
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
404
|
-
choiceRationaleEnabled: choiceRationale.settings && toggle(choiceRationale.label),
|
|
405
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
406
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
407
|
-
rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
|
|
408
|
-
};
|
|
409
|
-
const getPluginProps = (props = {}) => ({
|
|
410
|
-
...baseInputConfiguration,
|
|
411
|
-
...props
|
|
412
|
-
});
|
|
413
|
-
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
414
|
-
extraCSSRules: {
|
|
415
|
-
names: ['red', 'blue'],
|
|
416
|
-
rules: `
|
|
417
|
-
.red {
|
|
418
|
-
color: red !important;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.blue {
|
|
422
|
-
color: blue !important;
|
|
423
|
-
}
|
|
424
|
-
`
|
|
425
|
-
},
|
|
426
|
-
dimensions: contentDimensions,
|
|
427
|
-
hideSettings: settingsPanelDisabled,
|
|
428
|
-
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
429
|
-
model: model,
|
|
430
|
-
configuration: configuration,
|
|
431
|
-
onChangeModel: model => this.onModelChange(model),
|
|
432
|
-
onChangeConfiguration: configuration => onConfigurationChanged(configuration, true),
|
|
433
|
-
groups: {
|
|
434
|
-
Settings: panelSettings,
|
|
435
|
-
Properties: panelProperties
|
|
436
|
-
}
|
|
437
|
-
})
|
|
438
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
439
|
-
label: teacherInstructions.label
|
|
440
|
-
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
441
|
-
markup: model.teacherInstructions || '',
|
|
442
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
443
|
-
imageSupport: imageSupport,
|
|
444
|
-
nonEmpty: false,
|
|
445
|
-
error: teacherInstructionsError,
|
|
446
|
-
toolbarOpts: toolbarOpts,
|
|
447
|
-
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
|
|
448
|
-
spellCheck: spellCheckEnabled,
|
|
449
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
450
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
451
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
452
|
-
languageCharactersProps: [{
|
|
453
|
-
language: 'spanish'
|
|
454
|
-
}, {
|
|
455
|
-
language: 'special'
|
|
456
|
-
}],
|
|
457
|
-
mathMlOptions: mathMlOptions
|
|
458
|
-
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
459
|
-
label: prompt.label
|
|
460
|
-
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
461
|
-
markup: model.prompt,
|
|
462
|
-
onChange: this.onPromptChanged,
|
|
463
|
-
imageSupport: imageSupport,
|
|
464
|
-
nonEmpty: false,
|
|
465
|
-
disableUnderline: true,
|
|
466
|
-
error: promptError,
|
|
467
|
-
toolbarOpts: toolbarOpts,
|
|
468
|
-
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
469
|
-
spellCheck: spellCheckEnabled,
|
|
470
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
471
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
472
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
473
|
-
languageCharactersProps: [{
|
|
474
|
-
language: 'spanish'
|
|
475
|
-
}, {
|
|
476
|
-
language: 'special'
|
|
477
|
-
}],
|
|
478
|
-
mathMlOptions: mathMlOptions
|
|
479
|
-
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(FlexContainer, null, /*#__PURE__*/_react.default.createElement(StyledTypography, {
|
|
480
|
-
component: 'div'
|
|
481
|
-
}, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react.default.createElement(StyledTooltip, {
|
|
482
|
-
disableFocusListener: true,
|
|
483
|
-
disableTouchListener: true,
|
|
484
|
-
placement: 'right',
|
|
485
|
-
title: validationMessage
|
|
486
|
-
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
487
|
-
fontSize: 'small',
|
|
488
|
-
color: 'primary'
|
|
489
|
-
}))), /*#__PURE__*/_react.default.createElement(_responseArea.default, {
|
|
490
|
-
responseAreasError: responseAreasError,
|
|
491
|
-
responseAreaChoicesError: responseAreaChoicesError,
|
|
492
|
-
editableHtmlProps: {
|
|
493
|
-
pluginProps: getPluginProps(template?.inputConfiguration),
|
|
494
|
-
activePlugins: _editableHtmlTipTap.ALL_PLUGINS,
|
|
495
|
-
toolbarOpts: {
|
|
496
|
-
position: 'top'
|
|
497
|
-
},
|
|
498
|
-
extraCSSRules: {
|
|
499
|
-
names: ['red', 'blue'],
|
|
500
|
-
rules: `
|
|
501
|
-
.red {
|
|
502
|
-
color: red !important;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
.blue {
|
|
506
|
-
color: blue !important;
|
|
507
|
-
}
|
|
508
|
-
`
|
|
509
|
-
},
|
|
510
|
-
responseAreaProps: {
|
|
511
|
-
type: 'inline-dropdown',
|
|
512
|
-
options: {
|
|
513
|
-
duplicates: true
|
|
514
|
-
},
|
|
515
|
-
maxResponseAreas: maxResponseAreas,
|
|
516
|
-
respAreaToolbar: (nodeInfo, editor, onToolbarDone) => {
|
|
517
|
-
const [node, pos] = nodeInfo;
|
|
518
|
-
const {
|
|
519
|
-
respAreaChoices
|
|
520
|
-
} = this.state;
|
|
521
|
-
return props => /*#__PURE__*/_react.default.createElement(_inlineDropdownToolbar.default, (0, _extends2.default)({}, props, {
|
|
522
|
-
onAddChoice: this.onAddChoice,
|
|
523
|
-
onCheck: this.onCheck,
|
|
524
|
-
onRemoveChoice: index => this.onRemoveChoice(node.attrs.index, index),
|
|
525
|
-
onSelectChoice: index => this.onSelectChoice(node.attrs.index, index),
|
|
526
|
-
node: node,
|
|
527
|
-
pos: pos,
|
|
528
|
-
editor: editor,
|
|
529
|
-
onToolbarDone: onToolbarDone,
|
|
530
|
-
choices: respAreaChoices[node.attrs.index],
|
|
531
|
-
spellCheck: spellCheckEnabled,
|
|
532
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
533
|
-
mathMlOptions: mathMlOptions,
|
|
534
|
-
baseInputConfiguration: baseInputConfiguration,
|
|
535
|
-
responseAreaInputConfiguration: responseAreaInputConfiguration
|
|
536
|
-
}));
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
spellCheck: spellCheckEnabled,
|
|
540
|
-
markup: model.slateMarkup || '',
|
|
541
|
-
onChange: this.onChange,
|
|
542
|
-
imageSupport: imageSupport,
|
|
543
|
-
disableImageAlignmentButtons: true,
|
|
544
|
-
disabled: false,
|
|
545
|
-
highlightShape: false,
|
|
546
|
-
error: responseAreasError,
|
|
547
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
548
|
-
languageCharactersProps: [{
|
|
549
|
-
language: 'spanish'
|
|
550
|
-
}, {
|
|
551
|
-
language: 'special'
|
|
552
|
-
}],
|
|
553
|
-
mathMlOptions: mathMlOptions
|
|
554
|
-
}
|
|
555
|
-
}), choiceRationaleEnabled && renderChoiceRationale(), rationaleEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
556
|
-
label: rationale.label
|
|
557
|
-
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
558
|
-
markup: model.rationale || '',
|
|
559
|
-
onChange: this.onRationaleChanged,
|
|
560
|
-
imageSupport: imageSupport,
|
|
561
|
-
error: rationaleError,
|
|
562
|
-
toolbarOpts: toolbarOpts,
|
|
563
|
-
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
564
|
-
spellCheck: spellCheckEnabled,
|
|
565
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
566
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
567
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
568
|
-
languageCharactersProps: [{
|
|
569
|
-
language: 'spanish'
|
|
570
|
-
}, {
|
|
571
|
-
language: 'special'
|
|
572
|
-
}],
|
|
573
|
-
mathMlOptions: mathMlOptions
|
|
574
|
-
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)), /*#__PURE__*/_react.default.createElement(_configUi.AlertDialog, {
|
|
575
|
-
open: warning.open,
|
|
576
|
-
title: "Warning",
|
|
577
|
-
text: warning.text,
|
|
578
|
-
onClose: warning.onClose,
|
|
579
|
-
onConfirm: warning.onConfirm,
|
|
580
|
-
disableAutoFocus: true,
|
|
581
|
-
disableEnforceFocus: true,
|
|
582
|
-
disableRestoreFocus: true
|
|
583
|
-
}));
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
exports.Main = Main;
|
|
587
|
-
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
588
|
-
configuration: _propTypes.default.object.isRequired,
|
|
589
|
-
model: _propTypes.default.object.isRequired,
|
|
590
|
-
disableSidePanel: _propTypes.default.bool,
|
|
591
|
-
onModelChanged: _propTypes.default.func.isRequired,
|
|
592
|
-
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
593
|
-
imageSupport: _propTypes.default.shape({
|
|
594
|
-
add: _propTypes.default.func.isRequired,
|
|
595
|
-
delete: _propTypes.default.func.isRequired
|
|
596
|
-
}),
|
|
597
|
-
uploadSoundSupport: _propTypes.default.shape({
|
|
598
|
-
add: _propTypes.default.func.isRequired,
|
|
599
|
-
delete: _propTypes.default.func.isRequired
|
|
600
|
-
})
|
|
601
|
-
});
|
|
602
|
-
var _default = exports.default = Main;
|
|
603
|
-
//# sourceMappingURL=main.js.map
|