@instructure/quiz-core 20.17.1-rc.1 → 20.17.1-rc.11
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/es/common/components/resources/stimulus/StimulusEdit/presenter.js +44 -26
- package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +2 -2
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +46 -26
- package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +2 -2
- package/package.json +9 -10
|
@@ -13,6 +13,7 @@ import PropTypes from 'prop-types';
|
|
|
13
13
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
14
14
|
import first from 'lodash/first';
|
|
15
15
|
import partial from 'lodash/partial';
|
|
16
|
+
import ReactDOM from 'react-dom';
|
|
16
17
|
import { Button } from '@instructure/ui-buttons';
|
|
17
18
|
import { ToggleDetails } from '@instructure/ui-toggle-details';
|
|
18
19
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
@@ -164,72 +165,76 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
164
165
|
_this$props2 = _this.props, stimulus = _this$props2.stimulus, workingStimulus = _this$props2.workingStimulus, quizId = _this$props2.quizId, quizEntry = _this$props2.quizEntry;
|
|
165
166
|
|
|
166
167
|
if (workingStimulus.isValid()) {
|
|
167
|
-
_context2.next =
|
|
168
|
+
_context2.next = 8;
|
|
168
169
|
break;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
|
|
172
|
+
_context2.next = 4;
|
|
173
|
+
return _this.props.showError(_this.props.guid);
|
|
172
174
|
|
|
175
|
+
case 4:
|
|
173
176
|
_this.props.screenreaderNotification(t('Simulus not saved due to validation errors with the data.'));
|
|
174
177
|
|
|
175
178
|
_this.props.clearNextQuizEntry();
|
|
176
179
|
|
|
180
|
+
_this.focusFirstErrorField();
|
|
181
|
+
|
|
177
182
|
return _context2.abrupt("return");
|
|
178
183
|
|
|
179
|
-
case
|
|
184
|
+
case 8:
|
|
180
185
|
_this.setState({
|
|
181
186
|
canSubmit: false
|
|
182
187
|
});
|
|
183
188
|
|
|
184
189
|
_this.props.hideError(_this.props.guid);
|
|
185
190
|
|
|
186
|
-
_context2.prev =
|
|
191
|
+
_context2.prev = 10;
|
|
187
192
|
|
|
188
193
|
if (!stimulus.isTemporary()) {
|
|
189
|
-
_context2.next =
|
|
194
|
+
_context2.next = 17;
|
|
190
195
|
break;
|
|
191
196
|
}
|
|
192
197
|
|
|
193
|
-
_context2.next =
|
|
198
|
+
_context2.next = 14;
|
|
194
199
|
return _this.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
|
|
195
200
|
|
|
196
|
-
case
|
|
201
|
+
case 14:
|
|
197
202
|
_this.props.clearTemporaryStimulus(quizId);
|
|
198
203
|
|
|
199
|
-
_context2.next =
|
|
204
|
+
_context2.next = 28;
|
|
200
205
|
break;
|
|
201
206
|
|
|
202
|
-
case
|
|
207
|
+
case 17:
|
|
203
208
|
if (!_this.props.shouldClone) {
|
|
204
|
-
_context2.next =
|
|
209
|
+
_context2.next = 26;
|
|
205
210
|
break;
|
|
206
211
|
}
|
|
207
212
|
|
|
208
|
-
_context2.next =
|
|
213
|
+
_context2.next = 20;
|
|
209
214
|
return _this.props.createStimulus(workingStimulus, _this.props.quizId, 'quiz', workingStimulus.id);
|
|
210
215
|
|
|
211
|
-
case
|
|
216
|
+
case 20:
|
|
212
217
|
stimulusData = _context2.sent;
|
|
213
|
-
_context2.next =
|
|
218
|
+
_context2.next = 23;
|
|
214
219
|
return _this.handleStimulusCreated(stimulusData);
|
|
215
220
|
|
|
216
|
-
case
|
|
221
|
+
case 23:
|
|
217
222
|
_this.props.clearTemporaryStimulus(quizId);
|
|
218
223
|
|
|
219
|
-
_context2.next =
|
|
224
|
+
_context2.next = 28;
|
|
220
225
|
break;
|
|
221
226
|
|
|
222
|
-
case
|
|
223
|
-
_context2.next =
|
|
227
|
+
case 26:
|
|
228
|
+
_context2.next = 28;
|
|
224
229
|
return _this.props.updateStimulus(workingStimulus.toJS(), quizId);
|
|
225
230
|
|
|
226
|
-
case
|
|
227
|
-
_context2.next =
|
|
231
|
+
case 28:
|
|
232
|
+
_context2.next = 34;
|
|
228
233
|
break;
|
|
229
234
|
|
|
230
|
-
case
|
|
231
|
-
_context2.prev =
|
|
232
|
-
_context2.t0 = _context2["catch"](
|
|
235
|
+
case 30:
|
|
236
|
+
_context2.prev = 30;
|
|
237
|
+
_context2.t0 = _context2["catch"](10);
|
|
233
238
|
|
|
234
239
|
_this.setState({
|
|
235
240
|
canSubmit: true
|
|
@@ -237,15 +242,15 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
237
242
|
|
|
238
243
|
throw _context2.t0;
|
|
239
244
|
|
|
240
|
-
case
|
|
245
|
+
case 34:
|
|
241
246
|
_this.afterSubmit();
|
|
242
247
|
|
|
243
|
-
case
|
|
248
|
+
case 35:
|
|
244
249
|
case "end":
|
|
245
250
|
return _context2.stop();
|
|
246
251
|
}
|
|
247
252
|
}
|
|
248
|
-
}, _callee2, null, [[
|
|
253
|
+
}, _callee2, null, [[10, 30]]);
|
|
249
254
|
}));
|
|
250
255
|
|
|
251
256
|
return function (_x2) {
|
|
@@ -253,6 +258,18 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
253
258
|
};
|
|
254
259
|
}();
|
|
255
260
|
|
|
261
|
+
_this.focusFirstErrorField = function () {
|
|
262
|
+
if (_this.stimulusEditArea) {
|
|
263
|
+
var editArea = ReactDOM.findDOMNode(_this.stimulusEditArea);
|
|
264
|
+
var firstErrorField = editArea === null || editArea === void 0 ? void 0 : editArea.querySelector('[aria-invalid="true"]');
|
|
265
|
+
firstErrorField && firstErrorField.focus();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
_this.handleRef = function (node) {
|
|
270
|
+
_this.stimulusEditArea = node;
|
|
271
|
+
};
|
|
272
|
+
|
|
256
273
|
_this.onSuccess = function (url) {
|
|
257
274
|
_this.props.setUploadStatus(FILE_UPLOAD_SUCCESS);
|
|
258
275
|
};
|
|
@@ -393,7 +410,8 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
393
410
|
key: "renderStimulusEdit",
|
|
394
411
|
value: function renderStimulusEdit() {
|
|
395
412
|
return jsx("div", null, jsx("div", {
|
|
396
|
-
css: this.props.styles.stimulus
|
|
413
|
+
css: this.props.styles.stimulus,
|
|
414
|
+
ref: this.handleRef
|
|
397
415
|
}, jsx("div", {
|
|
398
416
|
css: this.props.styles.header
|
|
399
417
|
}, jsx("div", {
|
|
@@ -148,11 +148,11 @@ export var StimulusEditInfo = (_dec = withStyle(generateStyle, generateComponent
|
|
|
148
148
|
css: this.props.styles.section
|
|
149
149
|
}, jsx(FormField, {
|
|
150
150
|
id: stimulusBodyId,
|
|
151
|
-
label: t('Content')
|
|
152
|
-
messages: this.inputErrors('body')
|
|
151
|
+
label: t('Content')
|
|
153
152
|
}, jsx(RichContentInput, {
|
|
154
153
|
actsAsInput: true,
|
|
155
154
|
label: "",
|
|
155
|
+
messages: this.inputErrors('body'),
|
|
156
156
|
placeholder: t('Add Stimulus Content...'),
|
|
157
157
|
textareaId: textAreaId,
|
|
158
158
|
defaultContent: stimulus.get('body'),
|
|
@@ -29,6 +29,8 @@ var _first = _interopRequireDefault(require("lodash/first"));
|
|
|
29
29
|
|
|
30
30
|
var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
31
31
|
|
|
32
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
33
|
+
|
|
32
34
|
var _uiButtons = require("@instructure/ui-buttons");
|
|
33
35
|
|
|
34
36
|
var _uiToggleDetails = require("@instructure/ui-toggle-details");
|
|
@@ -199,72 +201,76 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
199
201
|
_this$props2 = _this.props, stimulus = _this$props2.stimulus, workingStimulus = _this$props2.workingStimulus, quizId = _this$props2.quizId, quizEntry = _this$props2.quizEntry;
|
|
200
202
|
|
|
201
203
|
if (workingStimulus.isValid()) {
|
|
202
|
-
_context2.next =
|
|
204
|
+
_context2.next = 8;
|
|
203
205
|
break;
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
_context2.next = 4;
|
|
209
|
+
return _this.props.showError(_this.props.guid);
|
|
207
210
|
|
|
211
|
+
case 4:
|
|
208
212
|
_this.props.screenreaderNotification((0, _formatMessage.default)('Simulus not saved due to validation errors with the data.'));
|
|
209
213
|
|
|
210
214
|
_this.props.clearNextQuizEntry();
|
|
211
215
|
|
|
216
|
+
_this.focusFirstErrorField();
|
|
217
|
+
|
|
212
218
|
return _context2.abrupt("return");
|
|
213
219
|
|
|
214
|
-
case
|
|
220
|
+
case 8:
|
|
215
221
|
_this.setState({
|
|
216
222
|
canSubmit: false
|
|
217
223
|
});
|
|
218
224
|
|
|
219
225
|
_this.props.hideError(_this.props.guid);
|
|
220
226
|
|
|
221
|
-
_context2.prev =
|
|
227
|
+
_context2.prev = 10;
|
|
222
228
|
|
|
223
229
|
if (!stimulus.isTemporary()) {
|
|
224
|
-
_context2.next =
|
|
230
|
+
_context2.next = 17;
|
|
225
231
|
break;
|
|
226
232
|
}
|
|
227
233
|
|
|
228
|
-
_context2.next =
|
|
234
|
+
_context2.next = 14;
|
|
229
235
|
return _this.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
|
|
230
236
|
|
|
231
|
-
case
|
|
237
|
+
case 14:
|
|
232
238
|
_this.props.clearTemporaryStimulus(quizId);
|
|
233
239
|
|
|
234
|
-
_context2.next =
|
|
240
|
+
_context2.next = 28;
|
|
235
241
|
break;
|
|
236
242
|
|
|
237
|
-
case
|
|
243
|
+
case 17:
|
|
238
244
|
if (!_this.props.shouldClone) {
|
|
239
|
-
_context2.next =
|
|
245
|
+
_context2.next = 26;
|
|
240
246
|
break;
|
|
241
247
|
}
|
|
242
248
|
|
|
243
|
-
_context2.next =
|
|
249
|
+
_context2.next = 20;
|
|
244
250
|
return _this.props.createStimulus(workingStimulus, _this.props.quizId, 'quiz', workingStimulus.id);
|
|
245
251
|
|
|
246
|
-
case
|
|
252
|
+
case 20:
|
|
247
253
|
stimulusData = _context2.sent;
|
|
248
|
-
_context2.next =
|
|
254
|
+
_context2.next = 23;
|
|
249
255
|
return _this.handleStimulusCreated(stimulusData);
|
|
250
256
|
|
|
251
|
-
case
|
|
257
|
+
case 23:
|
|
252
258
|
_this.props.clearTemporaryStimulus(quizId);
|
|
253
259
|
|
|
254
|
-
_context2.next =
|
|
260
|
+
_context2.next = 28;
|
|
255
261
|
break;
|
|
256
262
|
|
|
257
|
-
case
|
|
258
|
-
_context2.next =
|
|
263
|
+
case 26:
|
|
264
|
+
_context2.next = 28;
|
|
259
265
|
return _this.props.updateStimulus(workingStimulus.toJS(), quizId);
|
|
260
266
|
|
|
261
|
-
case
|
|
262
|
-
_context2.next =
|
|
267
|
+
case 28:
|
|
268
|
+
_context2.next = 34;
|
|
263
269
|
break;
|
|
264
270
|
|
|
265
|
-
case
|
|
266
|
-
_context2.prev =
|
|
267
|
-
_context2.t0 = _context2["catch"](
|
|
271
|
+
case 30:
|
|
272
|
+
_context2.prev = 30;
|
|
273
|
+
_context2.t0 = _context2["catch"](10);
|
|
268
274
|
|
|
269
275
|
_this.setState({
|
|
270
276
|
canSubmit: true
|
|
@@ -272,15 +278,15 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
272
278
|
|
|
273
279
|
throw _context2.t0;
|
|
274
280
|
|
|
275
|
-
case
|
|
281
|
+
case 34:
|
|
276
282
|
_this.afterSubmit();
|
|
277
283
|
|
|
278
|
-
case
|
|
284
|
+
case 35:
|
|
279
285
|
case "end":
|
|
280
286
|
return _context2.stop();
|
|
281
287
|
}
|
|
282
288
|
}
|
|
283
|
-
}, _callee2, null, [[
|
|
289
|
+
}, _callee2, null, [[10, 30]]);
|
|
284
290
|
}));
|
|
285
291
|
|
|
286
292
|
return function (_x2) {
|
|
@@ -288,6 +294,19 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
288
294
|
};
|
|
289
295
|
}();
|
|
290
296
|
|
|
297
|
+
_this.focusFirstErrorField = function () {
|
|
298
|
+
if (_this.stimulusEditArea) {
|
|
299
|
+
var editArea = _reactDom.default.findDOMNode(_this.stimulusEditArea);
|
|
300
|
+
|
|
301
|
+
var firstErrorField = editArea === null || editArea === void 0 ? void 0 : editArea.querySelector('[aria-invalid="true"]');
|
|
302
|
+
firstErrorField && firstErrorField.focus();
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
_this.handleRef = function (node) {
|
|
307
|
+
_this.stimulusEditArea = node;
|
|
308
|
+
};
|
|
309
|
+
|
|
291
310
|
_this.onSuccess = function (url) {
|
|
292
311
|
_this.props.setUploadStatus(_quizCommon.FILE_UPLOAD_SUCCESS);
|
|
293
312
|
};
|
|
@@ -428,7 +447,8 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
428
447
|
key: "renderStimulusEdit",
|
|
429
448
|
value: function renderStimulusEdit() {
|
|
430
449
|
return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("div", {
|
|
431
|
-
css: this.props.styles.stimulus
|
|
450
|
+
css: this.props.styles.stimulus,
|
|
451
|
+
ref: this.handleRef
|
|
432
452
|
}, (0, _emotion.jsx)("div", {
|
|
433
453
|
css: this.props.styles.header
|
|
434
454
|
}, (0, _emotion.jsx)("div", {
|
|
@@ -175,11 +175,11 @@ var StimulusEditInfo = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.d
|
|
|
175
175
|
css: this.props.styles.section
|
|
176
176
|
}, (0, _emotion.jsx)(_uiFormField.FormField, {
|
|
177
177
|
id: stimulusBodyId,
|
|
178
|
-
label: (0, _formatMessage.default)('Content')
|
|
179
|
-
messages: this.inputErrors('body')
|
|
178
|
+
label: (0, _formatMessage.default)('Content')
|
|
180
179
|
}, (0, _emotion.jsx)(_quizRce.RichContentInput, {
|
|
181
180
|
actsAsInput: true,
|
|
182
181
|
label: "",
|
|
182
|
+
messages: this.inputErrors('body'),
|
|
183
183
|
placeholder: (0, _formatMessage.default)('Add Stimulus Content...'),
|
|
184
184
|
textareaId: textAreaId,
|
|
185
185
|
defaultContent: stimulus.get('body'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.17.1-rc.
|
|
3
|
+
"version": "20.17.1-rc.11+edb92d646",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
47
|
-
"@instructure/quiz-common": "20.17.1-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "20.17.1-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "20.17.1-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "20.17.1-rc.
|
|
51
|
-
"@instructure/quiz-rce": "20.17.1-rc.
|
|
47
|
+
"@instructure/quiz-common": "20.17.1-rc.11+edb92d646",
|
|
48
|
+
"@instructure/quiz-i18n": "20.17.1-rc.11+edb92d646",
|
|
49
|
+
"@instructure/quiz-interactions": "20.17.1-rc.11+edb92d646",
|
|
50
|
+
"@instructure/quiz-number-input": "20.17.1-rc.11+edb92d646",
|
|
51
|
+
"@instructure/quiz-rce": "20.17.1-rc.11+edb92d646",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"file-saver": "~2.0.5",
|
|
112
112
|
"humps": "^2.0.0",
|
|
113
113
|
"immutable": "^3.8.1",
|
|
114
|
-
"instructure-validations": "20.17.1-rc.
|
|
114
|
+
"instructure-validations": "20.17.1-rc.11+edb92d646",
|
|
115
115
|
"ipaddr.js": "^1.5.4",
|
|
116
116
|
"isomorphic-fetch": "^2.2.0",
|
|
117
117
|
"isuuid": "^0.1.0",
|
|
@@ -145,7 +145,6 @@
|
|
|
145
145
|
"@instructure/quiz-scripts": "20.17.0",
|
|
146
146
|
"@instructure/ui-axe-check": "^8.51.0",
|
|
147
147
|
"@instructure/ui-babel-preset": "^7.22.1",
|
|
148
|
-
"@instructure/ui-karma-config": "^7.22.1",
|
|
149
148
|
"@instructure/ui-postcss-config": "^7.22.1",
|
|
150
149
|
"@instructure/ui-scripts": "^7.22.1",
|
|
151
150
|
"@instructure/ui-test-utils": "^7.22.1",
|
|
@@ -163,7 +162,7 @@
|
|
|
163
162
|
"jquery": "^2.2.3",
|
|
164
163
|
"karma-junit-reporter": "^2.0.1",
|
|
165
164
|
"most-subject": "^5.3.0",
|
|
166
|
-
"quiz-presets": "20.17.1-rc.
|
|
165
|
+
"quiz-presets": "20.17.1-rc.11+edb92d646",
|
|
167
166
|
"react": "^16.8.6",
|
|
168
167
|
"react-addons-test-utils": "^15.6.2",
|
|
169
168
|
"react-dom": "^16.8.6",
|
|
@@ -179,5 +178,5 @@
|
|
|
179
178
|
"publishConfig": {
|
|
180
179
|
"access": "public"
|
|
181
180
|
},
|
|
182
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "edb92d6465450d54fbc97ef18c501a6abe7e5cc6"
|
|
183
182
|
}
|