@instructure/quiz-core 17.32.1-rc.0 → 17.32.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/banks/components/BankEntry/presenter.js +1 -2
- package/es/common/components/SDKApp/index.js +8 -0
- package/es/common/components/resources/item/ItemEdit/index.js +1 -0
- package/es/common/components/resources/item/ItemEdit/presenter.js +4 -3
- package/es/common/util/fitbCopyHelper.js +11 -3
- package/es/common/util/interactionTypePropsHelper.js +2 -0
- package/lib/banks/components/BankEntry/presenter.js +1 -2
- package/lib/common/components/SDKApp/index.js +8 -0
- package/lib/common/components/resources/item/ItemEdit/index.js +1 -0
- package/lib/common/components/resources/item/ItemEdit/presenter.js +4 -3
- package/lib/common/util/fitbCopyHelper.js +10 -2
- package/lib/common/util/interactionTypePropsHelper.js +2 -0
- package/package.json +10 -10
|
@@ -305,7 +305,6 @@ export var BankEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
305
305
|
scope = _this$props.scope,
|
|
306
306
|
closeTray = _this$props.closeTray,
|
|
307
307
|
navigateToBanks = _this$props.navigateToBanks,
|
|
308
|
-
navigateToBank = _this$props.navigateToBank,
|
|
309
308
|
navigateToBuild = _this$props.navigateToBuild,
|
|
310
309
|
returnToUrl = _this$props.returnToUrl,
|
|
311
310
|
bank = _this$props.bank;
|
|
@@ -318,7 +317,7 @@ export var BankEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
318
317
|
canvasReferrerLinkText: isScopeEmpty ? null : scope.title
|
|
319
318
|
}, /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
320
319
|
key: "bank",
|
|
321
|
-
onClick: navigateToBank,
|
|
320
|
+
onClick: this.navigateToBank,
|
|
322
321
|
ref: this.setNavToBankRef
|
|
323
322
|
}, bank.title), /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
324
323
|
key: "bankEntry"
|
|
@@ -155,6 +155,13 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
|
|
|
155
155
|
/* eslint-disable-line react/no-unused-prop-types */
|
|
156
156
|
outcomesEndpoint: PropTypes.string,
|
|
157
157
|
outcomesToken: PropTypes.string,
|
|
158
|
+
rceConfig: PropTypes.shape({
|
|
159
|
+
contextId: PropTypes.string.isRequired,
|
|
160
|
+
contextType: PropTypes.string.isRequired,
|
|
161
|
+
canvasUserId: PropTypes.string.isRequired,
|
|
162
|
+
rcsHost: PropTypes.string.isRequired,
|
|
163
|
+
tokenFetchFn: PropTypes.func.isRequired
|
|
164
|
+
}),
|
|
158
165
|
timeZone: PropTypes.string,
|
|
159
166
|
translations: PropTypes.objectOf(PropTypes.shape({
|
|
160
167
|
message: PropTypes.string
|
|
@@ -168,6 +175,7 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
|
|
|
168
175
|
locale: null,
|
|
169
176
|
outcomesEndpoint: null,
|
|
170
177
|
outcomesToken: null,
|
|
178
|
+
rceConfig: null,
|
|
171
179
|
translations: null,
|
|
172
180
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
173
181
|
}, _temp)) || _class);
|
|
@@ -28,6 +28,7 @@ export function mapStateToProps(state, props) {
|
|
|
28
28
|
workingItem: workingItem,
|
|
29
29
|
isValid: isValid,
|
|
30
30
|
isEditing: true,
|
|
31
|
+
fitbCommonWordbankEnabled: featureOn('fitb_common_wordbank'),
|
|
31
32
|
editable: true,
|
|
32
33
|
contextUuid: contextUuid,
|
|
33
34
|
oneQuestionAtATime: isActiveQuizWorkingInstanceOneQuestionAtATime(state),
|
|
@@ -127,8 +127,8 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
127
127
|
key: "render",
|
|
128
128
|
value: function render() {
|
|
129
129
|
var item = this.props.entry;
|
|
130
|
-
var interactionType = item.getInteractionType();
|
|
131
|
-
var Interaction = componentForItem(interactionType
|
|
130
|
+
var interactionType = item.getInteractionType().slug;
|
|
131
|
+
var Interaction = componentForItem(interactionType, COMPONENT_EDIT);
|
|
132
132
|
var propsForInteraction = propsForInteractionEdit(this.props, this.additionalEditOptions());
|
|
133
133
|
return /*#__PURE__*/React.createElement(FormFieldGroup, {
|
|
134
134
|
messages: this.getError('onSelf'),
|
|
@@ -136,7 +136,6 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
136
136
|
name: "edit_item_".concat(this.props.guid) // eslint-disable-line react/jsx-no-literals
|
|
137
137
|
|
|
138
138
|
}, /*#__PURE__*/React.createElement(Interaction, Object.assign({}, propsForInteraction, {
|
|
139
|
-
interactionType: interactionType,
|
|
140
139
|
itemId: this.props.guid,
|
|
141
140
|
renderImportModal: this.renderImportModal
|
|
142
141
|
})));
|
|
@@ -156,6 +155,7 @@ ItemEdit.propTypes = {
|
|
|
156
155
|
appContainer: CustomPropTypes.selectors.isRequired,
|
|
157
156
|
changeOutcomeAlignmentSetGuid: PropTypes.func.isRequired,
|
|
158
157
|
entry: ImmutablePropTypes.record.isRequired,
|
|
158
|
+
fitbCommonWordbankEnabled: PropTypes.bool,
|
|
159
159
|
guid: PropTypes.string.isRequired,
|
|
160
160
|
occludeQuizEntries: PropTypes.func.isRequired,
|
|
161
161
|
contextUuid: PropTypes.string,
|
|
@@ -191,6 +191,7 @@ ItemEdit.defaultProps = {
|
|
|
191
191
|
additionalOptions: [],
|
|
192
192
|
answerFeedbackEnabled: false,
|
|
193
193
|
contextUuid: null,
|
|
194
|
+
fitbCommonWordbankEnabled: false,
|
|
194
195
|
errorsAreShowing: false,
|
|
195
196
|
outcomesEndpoint: null,
|
|
196
197
|
outcomesToken: null,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { List, Map } from 'immutable';
|
|
1
|
+
import { List, Map } from 'immutable'; // https://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript
|
|
2
|
+
|
|
3
|
+
function htmlEncode(input) {
|
|
4
|
+
return input.replace(/[\u00A0-\u9999<>&]/g, function (i) {
|
|
5
|
+
return '&#' + i.charCodeAt(0) + ';';
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
|
|
2
9
|
export function convertFITBtoRich(interactionTypeData, richFITBInteractionID) {
|
|
3
10
|
var interactionData = interactionTypeData.interactionData,
|
|
4
11
|
scoringData = interactionTypeData.scoringData;
|
|
@@ -7,12 +14,13 @@ export function convertFITBtoRich(interactionTypeData, richFITBInteractionID) {
|
|
|
7
14
|
});
|
|
8
15
|
var workingItemBody = sortedStemItems.reduce(function (itemBody, stemItem) {
|
|
9
16
|
if (stemItem.get('type') === 'text') {
|
|
10
|
-
return itemBody + stemItem.get('value', '');
|
|
17
|
+
return itemBody + htmlEncode(stemItem.get('value', ''));
|
|
11
18
|
} else {
|
|
12
19
|
var blankScoringData = scoringData.get('value', List()).find(function (blank) {
|
|
13
20
|
return blank.get('id') === stemItem.get('blankId');
|
|
14
21
|
}) || Map();
|
|
15
|
-
|
|
22
|
+
var blankText = blankScoringData.getIn(['scoringData', 'blankText'], '');
|
|
23
|
+
return itemBody + "`".concat(htmlEncode(blankText), "`");
|
|
16
24
|
}
|
|
17
25
|
}, '');
|
|
18
26
|
return Object.assign({}, interactionTypeData, {
|
|
@@ -38,10 +38,12 @@ export var propsForInteractionEdit = function propsForInteractionEdit(props, add
|
|
|
38
38
|
errors: props.workingItem.getErrors().toJS(),
|
|
39
39
|
validationErrorsFromApi: props.validationErrorsFromApi,
|
|
40
40
|
errorsAreShowing: props.errorsAreShowing,
|
|
41
|
+
fitbCommonWordbankEnabled: props.fitbCommonWordbankEnabled,
|
|
41
42
|
hiddenOptions: {
|
|
42
43
|
calculator: !props.showCalculator
|
|
43
44
|
},
|
|
44
45
|
interactionData: item.interactionData,
|
|
46
|
+
interactionType: props.entry.getInteractionType(),
|
|
45
47
|
// SHIM: canvas-rce breaks on null values now
|
|
46
48
|
// this is a shim until canvas-rce deals with
|
|
47
49
|
// null values better
|
|
@@ -357,7 +357,6 @@ var BankEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
|
|
|
357
357
|
scope = _this$props.scope,
|
|
358
358
|
closeTray = _this$props.closeTray,
|
|
359
359
|
navigateToBanks = _this$props.navigateToBanks,
|
|
360
|
-
navigateToBank = _this$props.navigateToBank,
|
|
361
360
|
navigateToBuild = _this$props.navigateToBuild,
|
|
362
361
|
returnToUrl = _this$props.returnToUrl,
|
|
363
362
|
bank = _this$props.bank;
|
|
@@ -370,7 +369,7 @@ var BankEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
|
|
|
370
369
|
canvasReferrerLinkText: isScopeEmpty ? null : scope.title
|
|
371
370
|
}, /*#__PURE__*/_react.default.createElement(_uiBreadcrumb.BreadcrumbLink, {
|
|
372
371
|
key: "bank",
|
|
373
|
-
onClick: navigateToBank,
|
|
372
|
+
onClick: this.navigateToBank,
|
|
374
373
|
ref: this.setNavToBankRef
|
|
375
374
|
}, bank.title), /*#__PURE__*/_react.default.createElement(_uiBreadcrumb.BreadcrumbLink, {
|
|
376
375
|
key: "bankEntry"
|
|
@@ -183,6 +183,13 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
|
|
|
183
183
|
/* eslint-disable-line react/no-unused-prop-types */
|
|
184
184
|
outcomesEndpoint: _propTypes.default.string,
|
|
185
185
|
outcomesToken: _propTypes.default.string,
|
|
186
|
+
rceConfig: _propTypes.default.shape({
|
|
187
|
+
contextId: _propTypes.default.string.isRequired,
|
|
188
|
+
contextType: _propTypes.default.string.isRequired,
|
|
189
|
+
canvasUserId: _propTypes.default.string.isRequired,
|
|
190
|
+
rcsHost: _propTypes.default.string.isRequired,
|
|
191
|
+
tokenFetchFn: _propTypes.default.func.isRequired
|
|
192
|
+
}),
|
|
186
193
|
timeZone: _propTypes.default.string,
|
|
187
194
|
translations: _propTypes.default.objectOf(_propTypes.default.shape({
|
|
188
195
|
message: _propTypes.default.string
|
|
@@ -196,6 +203,7 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
|
|
|
196
203
|
locale: null,
|
|
197
204
|
outcomesEndpoint: null,
|
|
198
205
|
outcomesToken: null,
|
|
206
|
+
rceConfig: null,
|
|
199
207
|
translations: null,
|
|
200
208
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
201
209
|
}, _temp)) || _class);
|
|
@@ -56,6 +56,7 @@ function mapStateToProps(state, props) {
|
|
|
56
56
|
workingItem: workingItem,
|
|
57
57
|
isValid: isValid,
|
|
58
58
|
isEditing: true,
|
|
59
|
+
fitbCommonWordbankEnabled: (0, _featureCheck.featureOn)('fitb_common_wordbank'),
|
|
59
60
|
editable: true,
|
|
60
61
|
contextUuid: contextUuid,
|
|
61
62
|
oneQuestionAtATime: (0, _quizzes2.isActiveQuizWorkingInstanceOneQuestionAtATime)(state),
|
|
@@ -157,8 +157,8 @@ var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
157
157
|
key: "render",
|
|
158
158
|
value: function render() {
|
|
159
159
|
var item = this.props.entry;
|
|
160
|
-
var interactionType = item.getInteractionType();
|
|
161
|
-
var Interaction = (0, _componentForItem.default)(interactionType
|
|
160
|
+
var interactionType = item.getInteractionType().slug;
|
|
161
|
+
var Interaction = (0, _componentForItem.default)(interactionType, _quizCommon.COMPONENT_EDIT);
|
|
162
162
|
var propsForInteraction = (0, _interactionTypePropsHelper.propsForInteractionEdit)(this.props, this.additionalEditOptions());
|
|
163
163
|
return /*#__PURE__*/_react.default.createElement(_uiFormField.FormFieldGroup, {
|
|
164
164
|
messages: this.getError('onSelf'),
|
|
@@ -166,7 +166,6 @@ var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
166
166
|
name: "edit_item_".concat(this.props.guid) // eslint-disable-line react/jsx-no-literals
|
|
167
167
|
|
|
168
168
|
}, /*#__PURE__*/_react.default.createElement(Interaction, Object.assign({}, propsForInteraction, {
|
|
169
|
-
interactionType: interactionType,
|
|
170
169
|
itemId: this.props.guid,
|
|
171
170
|
renderImportModal: this.renderImportModal
|
|
172
171
|
})));
|
|
@@ -187,6 +186,7 @@ ItemEdit.propTypes = {
|
|
|
187
186
|
appContainer: _CustomPropTypes.default.selectors.isRequired,
|
|
188
187
|
changeOutcomeAlignmentSetGuid: _propTypes.default.func.isRequired,
|
|
189
188
|
entry: _reactImmutableProptypes.default.record.isRequired,
|
|
189
|
+
fitbCommonWordbankEnabled: _propTypes.default.bool,
|
|
190
190
|
guid: _propTypes.default.string.isRequired,
|
|
191
191
|
occludeQuizEntries: _propTypes.default.func.isRequired,
|
|
192
192
|
contextUuid: _propTypes.default.string,
|
|
@@ -222,6 +222,7 @@ ItemEdit.defaultProps = {
|
|
|
222
222
|
additionalOptions: [],
|
|
223
223
|
answerFeedbackEnabled: false,
|
|
224
224
|
contextUuid: null,
|
|
225
|
+
fitbCommonWordbankEnabled: false,
|
|
225
226
|
errorsAreShowing: false,
|
|
226
227
|
outcomesEndpoint: null,
|
|
227
228
|
outcomesToken: null,
|
|
@@ -7,6 +7,13 @@ exports.convertFITBtoRich = convertFITBtoRich;
|
|
|
7
7
|
|
|
8
8
|
var _immutable = require("immutable");
|
|
9
9
|
|
|
10
|
+
// https://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript
|
|
11
|
+
function htmlEncode(input) {
|
|
12
|
+
return input.replace(/[\u00A0-\u9999<>&]/g, function (i) {
|
|
13
|
+
return '&#' + i.charCodeAt(0) + ';';
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
function convertFITBtoRich(interactionTypeData, richFITBInteractionID) {
|
|
11
18
|
var interactionData = interactionTypeData.interactionData,
|
|
12
19
|
scoringData = interactionTypeData.scoringData;
|
|
@@ -15,12 +22,13 @@ function convertFITBtoRich(interactionTypeData, richFITBInteractionID) {
|
|
|
15
22
|
});
|
|
16
23
|
var workingItemBody = sortedStemItems.reduce(function (itemBody, stemItem) {
|
|
17
24
|
if (stemItem.get('type') === 'text') {
|
|
18
|
-
return itemBody + stemItem.get('value', '');
|
|
25
|
+
return itemBody + htmlEncode(stemItem.get('value', ''));
|
|
19
26
|
} else {
|
|
20
27
|
var blankScoringData = scoringData.get('value', (0, _immutable.List)()).find(function (blank) {
|
|
21
28
|
return blank.get('id') === stemItem.get('blankId');
|
|
22
29
|
}) || (0, _immutable.Map)();
|
|
23
|
-
|
|
30
|
+
var blankText = blankScoringData.getIn(['scoringData', 'blankText'], '');
|
|
31
|
+
return itemBody + "`".concat(htmlEncode(blankText), "`");
|
|
24
32
|
}
|
|
25
33
|
}, '');
|
|
26
34
|
return Object.assign({}, interactionTypeData, {
|
|
@@ -50,10 +50,12 @@ var propsForInteractionEdit = function propsForInteractionEdit(props, additional
|
|
|
50
50
|
errors: props.workingItem.getErrors().toJS(),
|
|
51
51
|
validationErrorsFromApi: props.validationErrorsFromApi,
|
|
52
52
|
errorsAreShowing: props.errorsAreShowing,
|
|
53
|
+
fitbCommonWordbankEnabled: props.fitbCommonWordbankEnabled,
|
|
53
54
|
hiddenOptions: {
|
|
54
55
|
calculator: !props.showCalculator
|
|
55
56
|
},
|
|
56
57
|
interactionData: item.interactionData,
|
|
58
|
+
interactionType: props.entry.getInteractionType(),
|
|
57
59
|
// SHIM: canvas-rce breaks on null values now
|
|
58
60
|
// this is a shim until canvas-rce deals with
|
|
59
61
|
// null values better
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.32.1-rc.
|
|
3
|
+
"version": "17.32.1-rc.11+78ad8eb24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@instructure/outcomes-ui": "^2.1.2",
|
|
44
|
-
"@instructure/quiz-common": "17.32.1-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.32.1-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.32.1-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.32.1-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.32.1-rc.
|
|
44
|
+
"@instructure/quiz-common": "17.32.1-rc.11+78ad8eb24",
|
|
45
|
+
"@instructure/quiz-i18n": "17.32.1-rc.11+78ad8eb24",
|
|
46
|
+
"@instructure/quiz-interactions": "17.32.1-rc.11+78ad8eb24",
|
|
47
|
+
"@instructure/quiz-number-input": "17.32.1-rc.11+78ad8eb24",
|
|
48
|
+
"@instructure/quiz-rce": "17.32.1-rc.11+78ad8eb24",
|
|
49
49
|
"@instructure/ui-a11y-content": "^7.11.0",
|
|
50
50
|
"@instructure/ui-alerts": "^7.11.0",
|
|
51
51
|
"@instructure/ui-avatar": "^7.11.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"eventemitter3": "^3.1.0",
|
|
107
107
|
"humps": "^2.0.0",
|
|
108
108
|
"immutable": "^3.8.1",
|
|
109
|
-
"instructure-validations": "17.32.1-rc.
|
|
109
|
+
"instructure-validations": "17.32.1-rc.11+78ad8eb24",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"uuid": "^3.2.1"
|
|
138
138
|
},
|
|
139
139
|
"devDependencies": {
|
|
140
|
-
"@instructure/quiz-scripts": "17.32.1-rc.
|
|
140
|
+
"@instructure/quiz-scripts": "17.32.1-rc.11+78ad8eb24",
|
|
141
141
|
"@instructure/ui-axe-check": "^7.11.0",
|
|
142
142
|
"@instructure/ui-babel-preset": "^7.11.0",
|
|
143
143
|
"@instructure/ui-karma-config": "^7.11.0",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"intl": "^1.2.4",
|
|
157
157
|
"jquery": "^2.2.3",
|
|
158
158
|
"most-subject": "^5.3.0",
|
|
159
|
-
"quiz-presets": "17.32.1-rc.
|
|
159
|
+
"quiz-presets": "17.32.1-rc.11+78ad8eb24",
|
|
160
160
|
"react": "^16.8.6",
|
|
161
161
|
"react-addons-test-utils": "^15.6.2",
|
|
162
162
|
"react-dom": "^16.8.6",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"publishConfig": {
|
|
173
173
|
"access": "public"
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "78ad8eb24fe924bcd0a5b08acafb89d8a16ecb00"
|
|
176
176
|
}
|