@pie-element/select-text 12.0.0-next.43 → 12.1.0-next.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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/select-text",
3
+ "repository": "pie-framework/pie-elements",
3
4
  "publishConfig": {
4
5
  "access": "public"
5
6
  },
6
- "repository": "pie-framework/pie-elements",
7
- "version": "12.0.0-next.43+4249fa78f",
7
+ "version": "12.1.0-next.0",
8
8
  "description": "",
9
9
  "dependencies": {
10
10
  "@emotion/react": "^11.14.0",
@@ -12,17 +12,17 @@
12
12
  "@mui/icons-material": "^7.3.4",
13
13
  "@mui/material": "^7.3.4",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/correct-answer-toggle": "3.1.1-next.0",
16
- "@pie-lib/math-rendering": "4.1.1-next.0",
17
- "@pie-lib/render-ui": "5.1.1-next.0",
18
- "@pie-lib/text-select": "2.1.1-next.0",
15
+ "@pie-lib/correct-answer-toggle": "3.1.1-next.1",
16
+ "@pie-lib/math-rendering": "4.1.1-next.1",
17
+ "@pie-lib/render-ui": "5.1.1-next.1",
18
+ "@pie-lib/text-select": "2.1.1-next.1",
19
19
  "prop-types": "^15.8.1",
20
20
  "react": "18.3.1",
21
21
  "react-dom": "18.3.1"
22
22
  },
23
23
  "author": "",
24
24
  "license": "ISC",
25
- "gitHead": "4249fa78fc423ef0a8c89002b8f937c42b3478ea",
25
+ "gitHead": "38eb4b4700ca4eaad440566dfc50623ff8876a92",
26
26
  "scripts": {
27
27
  "postpublish": "../../scripts/postpublish"
28
28
  },
package/LICENSE.md DELETED
@@ -1,5 +0,0 @@
1
- Copyright 2019 CoreSpring Inc
2
-
3
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
-
5
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -1,174 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- model: {
9
- feedbackEnabled: false,
10
- highlightChoices: false,
11
- maxSelections: 0,
12
- mode: 'sentence',
13
- partialScoring: false,
14
- prompt: '',
15
- promptEnabled: true,
16
- rationale: '',
17
- rationaleEnabled: true,
18
- scoringType: 'auto',
19
- studentInstructionsEnabled: true,
20
- teacherInstructions: '',
21
- teacherInstructionsEnabled: true,
22
- text: '',
23
- tokens: [],
24
- toolbarEditorPosition: 'bottom'
25
- },
26
- configuration: {
27
- baseInputConfiguration: {
28
- audio: {
29
- disabled: false
30
- },
31
- video: {
32
- disabled: false
33
- },
34
- image: {
35
- disabled: false
36
- },
37
- textAlign: {
38
- disabled: true
39
- },
40
- showParagraphs: {
41
- disabled: false
42
- },
43
- separateParagraphs: {
44
- disabled: true
45
- }
46
- },
47
- selectionCount: {
48
- settings: true,
49
- label: 'Selection count'
50
- },
51
- correctAnswer: {
52
- settings: true,
53
- label: 'Correct Answers'
54
- },
55
- selections: {
56
- settings: true,
57
- label: 'Selections Available'
58
- },
59
- highlightChoices: {
60
- settings: true,
61
- label: 'Highlight choices'
62
- },
63
- rationale: {
64
- settings: true,
65
- label: 'Rationale',
66
- inputConfiguration: {
67
- audio: {
68
- disabled: false
69
- },
70
- video: {
71
- disabled: false
72
- },
73
- image: {
74
- disabled: false
75
- }
76
- },
77
- required: false
78
- },
79
- scoringType: {
80
- settings: false,
81
- label: 'Scoring Type'
82
- },
83
- studentInstructions: {
84
- settings: false,
85
- label: 'Student Instructions'
86
- },
87
- teacherInstructions: {
88
- settings: true,
89
- label: 'Teacher Instructions',
90
- inputConfiguration: {
91
- audio: {
92
- disabled: false
93
- },
94
- video: {
95
- disabled: false
96
- },
97
- image: {
98
- disabled: false
99
- }
100
- },
101
- required: false
102
- },
103
- prompt: {
104
- label: 'Prompt',
105
- settings: true,
106
- inputConfiguration: {
107
- audio: {
108
- disabled: false
109
- },
110
- video: {
111
- disabled: false
112
- },
113
- image: {
114
- disabled: false
115
- }
116
- },
117
- required: false
118
- },
119
- text: {
120
- settings: true,
121
- label: 'Content'
122
- },
123
- tokens: {
124
- settings: true,
125
- label: 'Tokens'
126
- },
127
- feedback: {
128
- settings: true,
129
- label: 'Feedback'
130
- },
131
- spellCheck: {
132
- label: 'Spellcheck',
133
- settings: false,
134
- enabled: true
135
- },
136
- partialScoring: {
137
- settings: false,
138
- label: 'Allow Partial Scoring'
139
- },
140
- mode: {
141
- settings: true,
142
- label: 'Mode'
143
- },
144
- minTokens: 2,
145
- maxImageWidth: {
146
- teacherInstructions: 300,
147
- prompt: 300,
148
- rationale: 300
149
- },
150
- maxImageHeight: {
151
- teacherInstructions: 300,
152
- prompt: 300,
153
- rationale: 300
154
- },
155
- withRubric: {
156
- settings: false,
157
- label: 'Add Rubric'
158
- },
159
- mathMlOptions: {
160
- mmlOutput: false,
161
- mmlEditing: false
162
- },
163
- language: {
164
- settings: false,
165
- label: 'Specify Language',
166
- enabled: false
167
- },
168
- languageChoices: {
169
- label: 'Language Choices',
170
- options: []
171
- }
172
- }
173
- };
174
- //# sourceMappingURL=defaultConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaultConfiguration.js","names":["model","feedbackEnabled","highlightChoices","maxSelections","mode","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","text","tokens","toolbarEditorPosition","configuration","baseInputConfiguration","audio","disabled","video","image","textAlign","showParagraphs","separateParagraphs","selectionCount","settings","label","correctAnswer","selections","inputConfiguration","required","studentInstructions","feedback","spellCheck","enabled","minTokens","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"sources":["../src/defaultConfiguration.js"],"sourcesContent":["export default {\n model: {\n feedbackEnabled: false,\n highlightChoices: false,\n maxSelections: 0,\n mode: 'sentence',\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n text: '',\n tokens: [],\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n selectionCount: {\n settings: true,\n label: 'Selection count',\n },\n correctAnswer: {\n settings: true,\n label: 'Correct Answers',\n },\n selections: {\n settings: true,\n label: 'Selections Available',\n },\n highlightChoices: {\n settings: true,\n label: 'Highlight choices',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n prompt: {\n label: 'Prompt',\n settings: true,\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n text: {\n settings: true,\n label: 'Content',\n },\n tokens: {\n settings: true,\n label: 'Tokens',\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n mode: {\n settings: true,\n label: 'Mode',\n },\n minTokens: 2,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":";;;;;;iCAAe;EACbA,KAAK,EAAE;IACLC,eAAe,EAAE,KAAK;IACtBC,gBAAgB,EAAE,KAAK;IACvBC,aAAa,EAAE,CAAC;IAChBC,IAAI,EAAE,UAAU;IAChBC,cAAc,EAAE,KAAK;IACrBC,MAAM,EAAE,EAAE;IACVC,aAAa,EAAE,IAAI;IACnBC,SAAS,EAAE,EAAE;IACbC,gBAAgB,EAAE,IAAI;IACtBC,WAAW,EAAE,MAAM;IACnBC,0BAA0B,EAAE,IAAI;IAChCC,mBAAmB,EAAE,EAAE;IACvBC,0BAA0B,EAAE,IAAI;IAChCC,IAAI,EAAE,EAAE;IACRC,MAAM,EAAE,EAAE;IACVC,qBAAqB,EAAE;EACzB,CAAC;EACDC,aAAa,EAAE;IACbC,sBAAsB,EAAE;MACtBC,KAAK,EAAE;QAAEC,QAAQ,EAAE;MAAM,CAAC;MAC1BC,KAAK,EAAE;QAAED,QAAQ,EAAE;MAAM,CAAC;MAC1BE,KAAK,EAAE;QAAEF,QAAQ,EAAE;MAAM,CAAC;MAC1BG,SAAS,EAAE;QAAEH,QAAQ,EAAE;MAAK,CAAC;MAC7BI,cAAc,EAAE;QAAEJ,QAAQ,EAAE;MAAM,CAAC;MACnCK,kBAA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pers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Design = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
12
- var _styles = require("@mui/material/styles");
13
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
14
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
15
- var _textSelect = require("@pie-lib/text-select");
16
- var _configUi = require("@pie-lib/config-ui");
17
- var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
18
- var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
19
- var _debug = _interopRequireDefault(require("debug"));
20
- var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
21
- var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
22
- var _utils = require("./utils");
23
- const {
24
- Panel,
25
- toggle,
26
- radio,
27
- dropdown
28
- } = _configUi.settings;
29
- const StyledInputContainer = (0, _styles.styled)(_configUi.InputContainer)(({
30
- theme
31
- }) => ({
32
- width: '100%',
33
- paddingTop: theme.spacing(2),
34
- marginBottom: theme.spacing(2)
35
- }));
36
- const StyledEditableHtml = (0, _styles.styled)(_editableHtmlTipTap.default)({
37
- width: '100%'
38
- });
39
- const ErrorText = (0, _styles.styled)('div')(({
40
- theme
41
- }) => ({
42
- fontSize: theme.typography.fontSize - 2,
43
- color: theme.palette.error.main,
44
- paddingTop: theme.spacing(1)
45
- }));
46
- const StyledTextField = (0, _styles.styled)(_TextField.default)({
47
- width: '100%'
48
- });
49
- const TokenizerContainer = (0, _styles.styled)(_configUi.InputContainer)(({
50
- theme
51
- }) => ({
52
- paddingRight: 0,
53
- marginRight: 0,
54
- position: 'relative',
55
- '&:after': {
56
- position: 'absolute',
57
- bottom: 0,
58
- left: 0,
59
- right: 0,
60
- height: '1px',
61
- content: '""',
62
- backgroundColor: theme.palette.primary.main
63
- },
64
- marginBottom: theme.spacing(1)
65
- }));
66
- const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
67
- theme
68
- }) => ({
69
- '& .MuiTooltip-tooltip': {
70
- fontSize: theme.typography.fontSize - 2,
71
- whiteSpace: 'pre',
72
- maxWidth: '500px'
73
- }
74
- }));
75
- const StyledTokenizer = (0, _styles.styled)(_textSelect.Tokenizer)(({
76
- theme
77
- }) => ({
78
- marginTop: theme.spacing(2)
79
- }));
80
- const StyledChip = (0, _styles.styled)(_Chip.default)(({
81
- theme
82
- }) => ({
83
- marginTop: theme.spacing(0.5),
84
- marginRight: theme.spacing(2)
85
- }));
86
- const TokensDetails = (0, _styles.styled)('div')(({
87
- theme
88
- }) => ({
89
- display: 'flex',
90
- alignItems: 'center',
91
- flexWrap: 'wrap',
92
- marginBottom: theme.spacing(2.5)
93
- }));
94
- const StyledNumberTextField = (0, _styles.styled)(_configUi.NumberTextField)(({
95
- theme
96
- }) => ({
97
- width: '180px',
98
- margin: `${theme.spacing(0.5)}px auto 0`
99
- }));
100
- const log = (0, _debug.default)('@pie-element:select-text:configure');
101
- class Design extends _react.default.Component {
102
- constructor(props) {
103
- super(props);
104
- (0, _defineProperty2.default)(this, "updateText", (0, _debounce.default)(val => {
105
- this.apply(u => {
106
- u.text = val;
107
- u.tokens = [];
108
- });
109
- }, 200));
110
- (0, _defineProperty2.default)(this, "changeText", event => this.updateText(event.target.value));
111
- (0, _defineProperty2.default)(this, "changeTokens", (tokens, mode) => {
112
- this.apply(u => {
113
- u.tokens = tokens;
114
- u.mode = mode;
115
- const correctTokenCount = tokens.filter(t => t.correct).length;
116
- const max = isFinite(u.maxSelections) ? u.maxSelections : 0;
117
- u.maxSelections = Math.max(max, correctTokenCount);
118
- });
119
- });
120
- (0, _defineProperty2.default)(this, "changeMaxSelections", (event, max) => {
121
- this.apply(u => u.maxSelections = max);
122
- });
123
- (0, _defineProperty2.default)(this, "apply", fn => {
124
- const {
125
- onModelChanged,
126
- model
127
- } = this.props;
128
- const update = (0, _cloneDeep.default)(model);
129
- fn(update);
130
- onModelChanged(update);
131
- });
132
- (0, _defineProperty2.default)(this, "changeFeedback", feedback => {
133
- this.apply(u => u.feedback = feedback);
134
- });
135
- (0, _defineProperty2.default)(this, "changePartialScoring", partialScoring => {
136
- const {
137
- onModelChanged,
138
- model
139
- } = this.props;
140
- const update = (0, _cloneDeep.default)(model);
141
- update.partialScoring = partialScoring;
142
- onModelChanged(update);
143
- });
144
- (0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
145
- const {
146
- onModelChanged,
147
- model
148
- } = this.props;
149
- const update = (0, _cloneDeep.default)(model);
150
- update.prompt = prompt;
151
- onModelChanged(update);
152
- });
153
- (0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
154
- const {
155
- onModelChanged,
156
- model
157
- } = this.props;
158
- const update = (0, _cloneDeep.default)(model);
159
- update.teacherInstructions = teacherInstructions;
160
- onModelChanged(update);
161
- });
162
- (0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
163
- const {
164
- onModelChanged,
165
- model
166
- } = this.props;
167
- onModelChanged({
168
- ...model,
169
- rationale
170
- });
171
- });
172
- const {
173
- model: _model
174
- } = this.props;
175
- this.state = {
176
- text: _model && _model.text || ''
177
- };
178
- }
179
- UNSAFE_componentWillReceiveProps(nProps) {
180
- const {
181
- model
182
- } = nProps;
183
- if (model && model.text) {
184
- this.setState({
185
- text: model.text
186
- });
187
- }
188
- }
189
- render() {
190
- const {
191
- text: textValue
192
- } = this.state;
193
- const {
194
- configuration,
195
- imageSupport,
196
- model,
197
- onConfigurationChanged,
198
- onModelChanged,
199
- uploadSoundSupport
200
- } = this.props;
201
- const {
202
- baseInputConfiguration = {},
203
- correctAnswer = {},
204
- contentDimensions = {},
205
- feedback = {},
206
- highlightChoices = {},
207
- mode = {},
208
- partialScoring = {},
209
- prompt = {},
210
- rationale = {},
211
- selectionCount = {},
212
- selections = {},
213
- settingsPanelDisabled,
214
- scoringType = {},
215
- spellCheck = {},
216
- studentInstructions = {},
217
- teacherInstructions = {},
218
- text = {},
219
- tokens = {},
220
- maxImageWidth = {},
221
- maxImageHeight = {},
222
- withRubric = {},
223
- mathMlOptions = {},
224
- language = {},
225
- languageChoices = {}
226
- } = configuration || {};
227
- const {
228
- errors,
229
- extraCSSRules,
230
- feedbackEnabled,
231
- promptEnabled,
232
- rationaleEnabled,
233
- spellCheckEnabled,
234
- teacherInstructionsEnabled,
235
- toolbarEditorPosition
236
- } = model || {};
237
- const {
238
- prompt: promptError,
239
- rationale: rationaleError,
240
- selectionsError,
241
- teacherInstructions: teacherInstructionsError,
242
- tokensError
243
- } = errors || {};
244
- const validationMessage = (0, _utils.generateValidationMessage)(configuration);
245
- const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
246
- const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
247
- let {
248
- tokens: tokensModel
249
- } = model;
250
- tokensModel = tokensModel || [];
251
- const toolbarOpts = {
252
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
253
- };
254
- log('[render] maxSelections:', model.maxSelections);
255
- const panelSettings = {
256
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
257
- highlightChoices: highlightChoices.settings && toggle(highlightChoices.label),
258
- feedbackEnabled: feedback.settings && toggle(feedback.label),
259
- 'language.enabled': language.settings && toggle(language.label, true),
260
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
261
- };
262
- const panelProperties = {
263
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
264
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
265
- promptEnabled: prompt.settings && toggle(prompt.label),
266
- rationaleEnabled: rationale.settings && toggle(rationale.label),
267
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
268
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
269
- rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
270
- };
271
- const getPluginProps = (props = {}) => ({
272
- ...baseInputConfiguration,
273
- ...props
274
- });
275
- return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
276
- extraCSSRules: extraCSSRules,
277
- dimensions: contentDimensions,
278
- hideSettings: settingsPanelDisabled,
279
- settings: /*#__PURE__*/_react.default.createElement(Panel, {
280
- model: model,
281
- configuration: configuration,
282
- onChangeModel: model => onModelChanged(model),
283
- onChangeConfiguration: onConfigurationChanged,
284
- groups: {
285
- Settings: panelSettings,
286
- Properties: panelProperties
287
- }
288
- })
289
- }, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
290
- label: teacherInstructions.label
291
- }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
292
- markup: model.teacherInstructions || '',
293
- onChange: this.onTeacherInstructionsChanged,
294
- imageSupport: imageSupport,
295
- nonEmpty: false,
296
- error: teacherInstructionsError,
297
- toolbarOpts: toolbarOpts,
298
- pluginProps: getPluginProps(configuration?.teacherInstructions?.inputConfiguration),
299
- spellCheck: spellCheckEnabled,
300
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
301
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
302
- uploadSoundSupport: uploadSoundSupport,
303
- languageCharactersProps: [{
304
- language: 'spanish'
305
- }, {
306
- language: 'special'
307
- }],
308
- mathMlOptions: mathMlOptions
309
- }), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
310
- label: prompt.label || ''
311
- }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
312
- markup: model.prompt,
313
- onChange: this.onPromptChanged,
314
- imageSupport: imageSupport,
315
- error: promptError,
316
- toolbarOpts: toolbarOpts,
317
- pluginProps: getPluginProps(configuration?.prompt?.inputConfiguration),
318
- spellCheck: spellCheckEnabled,
319
- maxImageWidth: defaultImageMaxWidth,
320
- maxImageHeight: defaultImageMaxHeight,
321
- uploadSoundSupport: uploadSoundSupport,
322
- languageCharactersProps: [{
323
- language: 'spanish'
324
- }, {
325
- language: 'special'
326
- }],
327
- mathMlOptions: mathMlOptions
328
- }), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), text.settings && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
329
- label: text.label || ''
330
- }, /*#__PURE__*/_react.default.createElement(StyledTextField, {
331
- variant: "standard",
332
- multiline: true,
333
- defaultValue: textValue,
334
- onChange: this.changeText,
335
- spellCheck: spellCheckEnabled
336
- })), tokens.settings && /*#__PURE__*/_react.default.createElement(TokenizerContainer, {
337
- label: tokens.label || ''
338
- }, /*#__PURE__*/_react.default.createElement(StyledTooltip, {
339
- disableFocusListener: true,
340
- disableTouchListener: true,
341
- placement: 'right',
342
- title: validationMessage
343
- }, /*#__PURE__*/_react.default.createElement(_Info.default, {
344
- fontSize: 'small',
345
- color: 'primary',
346
- style: {
347
- position: 'absolute',
348
- left: '48px',
349
- top: '-3px'
350
- }
351
- })), /*#__PURE__*/_react.default.createElement(StyledTokenizer, {
352
- text: model.text,
353
- tokens: tokensModel,
354
- onChange: this.changeTokens
355
- })), tokensError && /*#__PURE__*/_react.default.createElement(ErrorText, null, tokensError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), /*#__PURE__*/_react.default.createElement(TokensDetails, null, mode.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
356
- label: `${mode.label}: ${model.mode ? model.mode : 'None'}`
357
- }), selections.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
358
- label: `${selections.label}: ${tokensModel.length}`
359
- }), correctAnswer.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
360
- label: `${correctAnswer.label}: ${tokensModel.filter(t => t.correct).length}`
361
- }), selectionCount.settings && /*#__PURE__*/_react.default.createElement(StyledNumberTextField, {
362
- min: tokensModel.filter(t => t.correct).length || 0,
363
- label: `${selectionCount.label} (0:any)`,
364
- max: tokensModel.length,
365
- value: model.maxSelections,
366
- onChange: this.changeMaxSelections
367
- })), rationaleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
368
- label: rationale.label || ''
369
- }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
370
- markup: model.rationale || '',
371
- onChange: this.onRationaleChanged,
372
- imageSupport: imageSupport,
373
- error: rationaleError,
374
- toolbarOpts: toolbarOpts,
375
- pluginProps: getPluginProps(configuration?.rationale?.inputConfiguration),
376
- spellCheck: spellCheckEnabled,
377
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
378
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
379
- uploadSoundSupport: uploadSoundSupport,
380
- languageCharactersProps: [{
381
- language: 'spanish'
382
- }, {
383
- language: 'special'
384
- }],
385
- mathMlOptions: mathMlOptions
386
- }), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_configUi.FeedbackConfig, {
387
- feedback: model.feedback,
388
- onChange: this.changeFeedback,
389
- toolbarOpts: toolbarOpts
390
- }));
391
- }
392
- }
393
- exports.Design = Design;
394
- (0, _defineProperty2.default)(Design, "propTypes", {
395
- model: _propTypes.default.object.isRequired,
396
- configuration: _propTypes.default.object.isRequired,
397
- onModelChanged: _propTypes.default.func.isRequired,
398
- onConfigurationChanged: _propTypes.default.func.isRequired,
399
- imageSupport: _propTypes.default.shape({
400
- add: _propTypes.default.func.isRequired,
401
- delete: _propTypes.default.func.isRequired
402
- }),
403
- uploadSoundSupport: _propTypes.default.object
404
- });
405
- (0, _defineProperty2.default)(Design, "defaultProps", {});
406
- var _default = exports.default = Design;
407
- //# sourceMappingURL=design.js.map