@instructure/quiz-core 20.5.2-rc.3 → 20.5.2-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -425,8 +425,6 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
425
425
  guid: this.props.guid,
426
426
  stimulus: this.props.stimulus,
427
427
  isBankedContent: this.props.isBankedContent,
428
- parentId: this.props.quizId,
429
- parentType: "quiz",
430
428
  setTitleRef: this.setTitleRef
431
429
  }), this.renderAddToBankOptions())), /*#__PURE__*/React.createElement("div", {
432
430
  className: styles.footer
@@ -8,15 +8,13 @@ var _dec, _class, _class2, _temp;
8
8
  import React, { Component } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import ImmutablePropTypes from 'react-immutable-proptypes';
11
- import { List, Map } from 'immutable';
12
11
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
13
12
  import { TextInput } from '@instructure/ui-text-input';
14
- import { FormFieldLabel, FormFieldGroup } from '@instructure/ui-form-field';
13
+ import { FormField, FormFieldGroup } from '@instructure/ui-form-field';
15
14
  import { themeable } from '@instructure/ui-themeable';
16
15
  import { Heading } from '@instructure/ui-heading';
17
- import RichContentInput from "../../../RichContentInput/index.js";
16
+ import { RichContentInput, RCE_SINGLE_LINE_HEIGHT } from '@instructure/quiz-rce';
18
17
  import { toErrors } from "../../../../util/instUIMessages.js";
19
- import Errors from "../../../shared/errors/Errors.js";
20
18
  import { SimpleSelect } from '@instructure/ui-simple-select';
21
19
  import { IconUpdownLine } from '@instructure/ui-icons';
22
20
  import { ToggleDetails } from '@instructure/ui-toggle-details';
@@ -85,22 +83,6 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
85
83
  _this.props.modifyStimulus(newData);
86
84
  };
87
85
 
88
- _this.errorsList = function (field) {
89
- if (_this.props.errorsShowing) {
90
- var errorMap = _this.props.workingStimulus.getErrors() || Map();
91
- return errorMap.get(field) || List();
92
- }
93
- };
94
-
95
- _this.fileUploadUrl = function () {
96
- var _this$props = _this.props,
97
- stimulus = _this$props.stimulus,
98
- parentId = _this$props.parentId,
99
- parentType = _this$props.parentType;
100
- var resource = parentType === 'bank' ? 'banks' : 'quizzes';
101
- return "/api/".concat(resource, "/").concat(parentId, "/stimuli/").concat(stimulus.id, "/media_upload_url");
102
- };
103
-
104
86
  return _this;
105
87
  }
106
88
 
@@ -144,6 +126,8 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
144
126
  key: "render",
145
127
  value: function render() {
146
128
  var stimulus = this.props.workingStimulus;
129
+ var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
130
+ var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
147
131
  return /*#__PURE__*/React.createElement(FormFieldGroup, {
148
132
  messages: this.inputErrors('onSelf'),
149
133
  description: /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Edit Stimulus'))
@@ -168,18 +152,21 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
168
152
  value: stimulus.get('instructions')
169
153
  })), /*#__PURE__*/React.createElement("div", {
170
154
  className: styles.section
171
- }, /*#__PURE__*/React.createElement(FormFieldLabel, null, t('Content')), /*#__PURE__*/React.createElement(RichContentInput, {
172
- label: "" // eslint-disable-next-line react/jsx-no-literals
173
- ,
174
- textareaId: "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent),
155
+ }, /*#__PURE__*/React.createElement(FormField, {
156
+ id: stimulusBodyId,
157
+ label: t('Content'),
158
+ messages: this.inputErrors('body')
159
+ }, /*#__PURE__*/React.createElement(RichContentInput, {
160
+ actsAsInput: true,
161
+ label: "",
162
+ placeholder: t('Add Stimulus Content...'),
163
+ textareaId: textAreaId,
175
164
  defaultContent: stimulus.get('body'),
176
165
  onKeyUp: this.onBodyChange,
177
166
  onBlur: this.onBodyChange,
178
167
  onChange: this.onBodyChange,
179
- uploadPath: this.fileUploadUrl()
180
- }), /*#__PURE__*/React.createElement(Errors, {
181
- errorList: this.errorsList('body')
182
- })), /*#__PURE__*/React.createElement("div", {
168
+ height: RCE_SINGLE_LINE_HEIGHT
169
+ }))), /*#__PURE__*/React.createElement("div", {
183
170
  className: styles.section
184
171
  }, /*#__PURE__*/React.createElement(ToggleDetails, {
185
172
  defaultExpanded: true,
@@ -205,8 +192,6 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
205
192
  workingStimulus: ImmutablePropTypes.record.isRequired,
206
193
  errorsShowing: PropTypes.bool.isRequired,
207
194
  modifyStimulus: PropTypes.func.isRequired,
208
- parentId: PropTypes.string.isRequired,
209
- parentType: PropTypes.string.isRequired,
210
195
  setTitleRef: PropTypes.func,
211
196
  stimulusOrientationEnabled: PropTypes.bool.isRequired
212
197
  }, _class2.defaultProps = {
@@ -462,8 +462,6 @@ var StimulusEdit = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
462
462
  guid: this.props.guid,
463
463
  stimulus: this.props.stimulus,
464
464
  isBankedContent: this.props.isBankedContent,
465
- parentId: this.props.quizId,
466
- parentType: "quiz",
467
465
  setTitleRef: this.setTitleRef
468
466
  }), this.renderAddToBankOptions())), /*#__PURE__*/_react.default.createElement("div", {
469
467
  className: styles.footer
@@ -23,8 +23,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
23
23
 
24
24
  var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
25
25
 
26
- var _immutable = require("immutable");
27
-
28
26
  var _uiA11yContent = require("@instructure/ui-a11y-content");
29
27
 
30
28
  var _uiTextInput = require("@instructure/ui-text-input");
@@ -35,12 +33,10 @@ var _uiThemeable = require("@instructure/ui-themeable");
35
33
 
36
34
  var _uiHeading = require("@instructure/ui-heading");
37
35
 
38
- var _index = _interopRequireDefault(require("../../../RichContentInput/index.js"));
36
+ var _quizRce = require("@instructure/quiz-rce");
39
37
 
40
38
  var _instUIMessages = require("../../../../util/instUIMessages.js");
41
39
 
42
- var _Errors = _interopRequireDefault(require("../../../shared/errors/Errors.js"));
43
-
44
40
  var _uiSimpleSelect = require("@instructure/ui-simple-select");
45
41
 
46
42
  var _uiIcons = require("@instructure/ui-icons");
@@ -117,22 +113,6 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
117
113
  _this.props.modifyStimulus(newData);
118
114
  };
119
115
 
120
- _this.errorsList = function (field) {
121
- if (_this.props.errorsShowing) {
122
- var errorMap = _this.props.workingStimulus.getErrors() || (0, _immutable.Map)();
123
- return errorMap.get(field) || (0, _immutable.List)();
124
- }
125
- };
126
-
127
- _this.fileUploadUrl = function () {
128
- var _this$props = _this.props,
129
- stimulus = _this$props.stimulus,
130
- parentId = _this$props.parentId,
131
- parentType = _this$props.parentType;
132
- var resource = parentType === 'bank' ? 'banks' : 'quizzes';
133
- return "/api/".concat(resource, "/").concat(parentId, "/stimuli/").concat(stimulus.id, "/media_upload_url");
134
- };
135
-
136
116
  return _this;
137
117
  }
138
118
 
@@ -176,6 +156,8 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
176
156
  key: "render",
177
157
  value: function render() {
178
158
  var stimulus = this.props.workingStimulus;
159
+ var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
160
+ var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
179
161
  return /*#__PURE__*/_react.default.createElement(_uiFormField.FormFieldGroup, {
180
162
  messages: this.inputErrors('onSelf'),
181
163
  description: /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage.default)('Edit Stimulus'))
@@ -200,18 +182,21 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
200
182
  value: stimulus.get('instructions')
201
183
  })), /*#__PURE__*/_react.default.createElement("div", {
202
184
  className: styles.section
203
- }, /*#__PURE__*/_react.default.createElement(_uiFormField.FormFieldLabel, null, (0, _formatMessage.default)('Content')), /*#__PURE__*/_react.default.createElement(_index.default, {
204
- label: "" // eslint-disable-next-line react/jsx-no-literals
205
- ,
206
- textareaId: "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent),
185
+ }, /*#__PURE__*/_react.default.createElement(_uiFormField.FormField, {
186
+ id: stimulusBodyId,
187
+ label: (0, _formatMessage.default)('Content'),
188
+ messages: this.inputErrors('body')
189
+ }, /*#__PURE__*/_react.default.createElement(_quizRce.RichContentInput, {
190
+ actsAsInput: true,
191
+ label: "",
192
+ placeholder: (0, _formatMessage.default)('Add Stimulus Content...'),
193
+ textareaId: textAreaId,
207
194
  defaultContent: stimulus.get('body'),
208
195
  onKeyUp: this.onBodyChange,
209
196
  onBlur: this.onBodyChange,
210
197
  onChange: this.onBodyChange,
211
- uploadPath: this.fileUploadUrl()
212
- }), /*#__PURE__*/_react.default.createElement(_Errors.default, {
213
- errorList: this.errorsList('body')
214
- })), /*#__PURE__*/_react.default.createElement("div", {
198
+ height: _quizRce.RCE_SINGLE_LINE_HEIGHT
199
+ }))), /*#__PURE__*/_react.default.createElement("div", {
215
200
  className: styles.section
216
201
  }, /*#__PURE__*/_react.default.createElement(_uiToggleDetails.ToggleDetails, {
217
202
  defaultExpanded: true,
@@ -236,8 +221,6 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
236
221
  workingStimulus: _reactImmutableProptypes.default.record.isRequired,
237
222
  errorsShowing: _propTypes.default.bool.isRequired,
238
223
  modifyStimulus: _propTypes.default.func.isRequired,
239
- parentId: _propTypes.default.string.isRequired,
240
- parentType: _propTypes.default.string.isRequired,
241
224
  setTitleRef: _propTypes.default.func,
242
225
  stimulusOrientationEnabled: _propTypes.default.bool.isRequired
243
226
  }, _class2.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.5.2-rc.3+3b6ee3085",
3
+ "version": "20.5.2-rc.5+8298d6e5e",
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.1.0",
47
- "@instructure/quiz-common": "20.5.2-rc.3+3b6ee3085",
48
- "@instructure/quiz-i18n": "20.5.2-rc.3+3b6ee3085",
49
- "@instructure/quiz-interactions": "20.5.2-rc.3+3b6ee3085",
50
- "@instructure/quiz-number-input": "20.5.2-rc.3+3b6ee3085",
51
- "@instructure/quiz-rce": "20.5.2-rc.3+3b6ee3085",
47
+ "@instructure/quiz-common": "20.5.2-rc.5+8298d6e5e",
48
+ "@instructure/quiz-i18n": "20.5.2-rc.5+8298d6e5e",
49
+ "@instructure/quiz-interactions": "20.5.2-rc.5+8298d6e5e",
50
+ "@instructure/quiz-number-input": "20.5.2-rc.5+8298d6e5e",
51
+ "@instructure/quiz-rce": "20.5.2-rc.5+8298d6e5e",
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",
@@ -112,7 +112,7 @@
112
112
  "file-saver": "~2.0.5",
113
113
  "humps": "^2.0.0",
114
114
  "immutable": "^3.8.1",
115
- "instructure-validations": "20.5.2-rc.3+3b6ee3085",
115
+ "instructure-validations": "20.5.2-rc.5+8298d6e5e",
116
116
  "ipaddr.js": "^1.5.4",
117
117
  "isomorphic-fetch": "^2.2.0",
118
118
  "isuuid": "^0.1.0",
@@ -163,7 +163,7 @@
163
163
  "intl": "^1.2.4",
164
164
  "jquery": "^2.2.3",
165
165
  "most-subject": "^5.3.0",
166
- "quiz-presets": "20.5.2-rc.3+3b6ee3085",
166
+ "quiz-presets": "20.5.2-rc.5+8298d6e5e",
167
167
  "react": "^16.8.6",
168
168
  "react-addons-test-utils": "^15.6.2",
169
169
  "react-dom": "^16.8.6",
@@ -179,5 +179,5 @@
179
179
  "publishConfig": {
180
180
  "access": "public"
181
181
  },
182
- "gitHead": "3b6ee30853d581afdb98402502bc3d2ad12e1023"
182
+ "gitHead": "8298d6e5e0feaf982877908b67d4c9e0ca018c28"
183
183
  }