@instructure/quiz-core 17.41.1-rc.11 → 17.41.1-rc.13

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.
@@ -121,7 +121,7 @@ export var ActionButtons = (_dec = themeable(theme, styles), _dec(_class = (_tem
121
121
  quizEntry: this.props.quizEntry,
122
122
  quizEntries: this.props.quizEntries,
123
123
  disabled: this.props.shouldDisableDragHandle
124
- }))), /*#__PURE__*/React.createElement(Button, {
124
+ }))), this.props.shouldRenderDelete && /*#__PURE__*/React.createElement(Button, {
125
125
  as: "div",
126
126
  onClick: this.props.onDelete,
127
127
  disabled: this.props.shouldDisableDeleteButton,
@@ -149,6 +149,7 @@ export var ActionButtons = (_dec = themeable(theme, styles), _dec(_class = (_tem
149
149
  shouldDisableDragHandle: PropTypes.bool,
150
150
  shouldDisableDeleteButton: PropTypes.bool,
151
151
  shouldRenderEdit: PropTypes.bool,
152
+ shouldRenderDelete: PropTypes.bool,
152
153
  switchOnEditing: PropTypes.func,
153
154
  shouldFocusOnMount: PropTypes.bool
154
155
  }, _class2.defaultProps = {
@@ -176,7 +176,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
176
176
  clearValidationErrorsFromApi: this.props.clearValidationErrorsFromApi,
177
177
  haveValidationErrorsFromApi: Boolean(Object.values(this.props.validationErrorsFromApi).length),
178
178
  useNewRce: isNewRCEEnabled()
179
- }, pick(this.props, ['displayPosition', 'guid', 'draggingOnBuild', 'newHoverPosition', 'quizEntry', 'quizEntries', 'quizId', 'setUi', 'switchOffEditing', 'switchOnEditing', 'shouldClone', 'scrollKey', 'editQuizEntryToggle', 'onEditQuizEntryToggle', 'stimulusOrientation']));
179
+ }, pick(this.props, ['displayPosition', 'guid', 'draggingOnBuild', 'newHoverPosition', 'quizEntry', 'quizEntries', 'quizId', 'isContentLockedByBlueprint', 'setUi', 'switchOffEditing', 'switchOnEditing', 'shouldClone', 'scrollKey', 'editQuizEntryToggle', 'onEditQuizEntryToggle', 'stimulusOrientation']));
180
180
  }
181
181
  }, {
182
182
  key: "isEditing",
@@ -262,6 +262,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
262
262
  dndRef: this.storeDndComponentRef,
263
263
  guid: this.props.guid,
264
264
  isBankedContent: bankEntryWarningWrapperProps !== void 0,
265
+ isContentLockedByBlueprint: this.props.isContentLockedByBlueprint,
265
266
  isEditing: this.isEditing(),
266
267
  draggingOnBuild: this.props.draggingOnBuild,
267
268
  newHoverPosition: this.props.newHoverPosition // used for DnD
@@ -358,6 +359,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
358
359
  quizEntries: ImmutablePropTypes.listOf(ImmutablePropTypes.record).isRequired,
359
360
  quizEntry: ImmutablePropTypes.record.isRequired,
360
361
  quizId: PropTypes.string.isRequired,
362
+ isContentLockedByBlueprint: PropTypes.bool.isRequired,
361
363
  regradingOn: PropTypes.bool.isRequired,
362
364
  screenreaderNotification: PropTypes.func.isRequired,
363
365
  scrollKey: PropTypes.string,
@@ -384,6 +386,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
384
386
  draggingOnBuild: false,
385
387
  draggingOver: false,
386
388
  initialFocusId: null,
389
+ isContentLockedByBlueprint: false,
387
390
  isEditing: false,
388
391
  partialDeepScoringEnabled: false,
389
392
  partialScoringEnabled: false,
@@ -25,6 +25,7 @@ function mapStateToProps(state, props) {
25
25
  modificationsClear: itemModsClear && quizEntryModsClear,
26
26
  quizEntryWithErrorsShowing: getQuizEntryWithErrorsShowing(state) || props.haveValidationErrorsFromApi,
27
27
  richFITBEnabled: featureOn('interaction_type_rich_fill_blank'),
28
+ lockBlueprintContentEnabled: featureOn('lock_blueprint_content'),
28
29
  richFITBInteractionID: (richFITBInteraction || Map()).get('id'),
29
30
  updateItemCallStatus: state.getIn(['calls', UPDATE_ITEM_CALL, 'requestStatus'], '')
30
31
  };
@@ -263,7 +263,9 @@ var QuizEntryShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
263
263
  draggingOver = _this$props2.draggingOver,
264
264
  draggingAboveHalf = _this$props2.draggingAboveHalf,
265
265
  quizEntry = _this$props2.quizEntry,
266
- stimulusOrientation = _this$props2.stimulusOrientation;
266
+ stimulusOrientation = _this$props2.stimulusOrientation,
267
+ isContentLockedByBlueprint = _this$props2.isContentLockedByBlueprint,
268
+ lockBlueprintContentEnabled = _this$props2.lockBlueprintContentEnabled;
267
269
  var positionToDisplay = this.props.quizEntry.positionToDisplay(displayPosition);
268
270
  var positionText = t('Preview of question at position {position}', {
269
271
  position: positionToDisplay
@@ -272,13 +274,15 @@ var QuizEntryShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
272
274
  var propsForDnDZone = {
273
275
  draggingOver: draggingOver,
274
276
  draggingAboveHalf: draggingAboveHalf
275
- }; // Overlay gets tabIndex === "-1" so that the drag handle is tabbable before
277
+ };
278
+ var shouldLockQuizEntry = lockBlueprintContentEnabled && isContentLockedByBlueprint; // Overlay gets tabIndex === "-1" so that the drag handle is tabbable before
276
279
  // the Overlay get focus and opens the quizEntry in edit mode
277
280
 
278
281
  return /*#__PURE__*/React.createElement(Overlay, {
279
282
  onClick: this.editingOn,
280
283
  wrapperClassName: styles.quizEntryWrapper,
281
- tabIndex: "-1"
284
+ tabIndex: "-1",
285
+ hideOverlay: shouldLockQuizEntry
282
286
  }, /*#__PURE__*/React.createElement(DragAndDropZone, Object.assign({}, propsForDnDZone, {
283
287
  location: "above"
284
288
  })), connectDragPreview( /*#__PURE__*/React.createElement("div", {
@@ -303,7 +307,10 @@ var QuizEntryShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
303
307
  scrollKey: this.props.scrollKey,
304
308
  shouldDisableDragHandle: this.shouldDisableDragHandle(),
305
309
  switchOnEditing: this.editingOn,
306
- shouldFocusOnMount: this.props.editQuizEntryToggle
310
+ shouldFocusOnMount: this.props.editQuizEntryToggle,
311
+ shouldDisableCopy: shouldLockQuizEntry,
312
+ shouldRenderEdit: !shouldLockQuizEntry,
313
+ shouldRenderDelete: !shouldLockQuizEntry
307
314
  }), /*#__PURE__*/React.createElement(ScreenReaderContent, null, srMsg)), /*#__PURE__*/React.createElement("div", {
308
315
  className: styles.itemHolder,
309
316
  ref: this.setInert,
@@ -331,10 +338,12 @@ var QuizEntryShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
331
338
  // only used in index.js
332
339
  interactionTypeName: PropTypes.string,
333
340
  modificationsClear: PropTypes.bool.isRequired,
341
+ lockBlueprintContentEnabled: PropTypes.bool.isRequired,
334
342
  quizEntryWithErrorsShowing: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
335
343
  quizEntries: ImmutablePropTypes.listOf(ImmutablePropTypes.record).isRequired,
336
344
  quizEntry: ImmutablePropTypes.record.isRequired,
337
345
  quizId: PropTypes.string.isRequired,
346
+ isContentLockedByBlueprint: PropTypes.bool.isRequired,
338
347
  removeQuizEntry: PropTypes.func.isRequired,
339
348
  // from connected component
340
349
  richFITBEnabled: PropTypes.bool,
@@ -351,11 +360,13 @@ var QuizEntryShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
351
360
  children: null,
352
361
  draggingOver: false,
353
362
  draggingAboveHalf: false,
363
+ lockBlueprintContentEnabled: false,
354
364
  quizEntryWithErrorsShowing: null,
355
365
  scrollKey: void 0,
356
366
  editQuizEntryToggle: false,
357
367
  haveValidationErrorsFromApi: false,
358
368
  interactionTypeName: null,
369
+ isContentLockedByBlueprint: false,
359
370
  richFITBEnabled: false,
360
371
  richFITBInteractionID: '',
361
372
  stimulusOrientation: null
@@ -15,6 +15,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
15
15
  dropIntoEmptyStimulus: draggingOver && dropIntoEmptyStimulus,
16
16
  draggingOver: draggingOver,
17
17
  draggingAboveHalf: draggingOver && draggingAboveHalf,
18
+ lockBlueprintContentEnabled: featureOn('lock_blueprint_content'),
18
19
  stimulusOrientationEnabled: featureOn('customizable_stimulus_orientation')
19
20
  };
20
21
  };
@@ -75,6 +75,14 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
75
75
  quizEntry = _this$props.quizEntry;
76
76
  return quizEntries.size === quizEntry.positionSlots + 1;
77
77
  }
78
+ }, {
79
+ key: "isQuizContentLocked",
80
+ value: function isQuizContentLocked() {
81
+ var _this$props2 = this.props,
82
+ isContentLockedByBlueprint = _this$props2.isContentLockedByBlueprint,
83
+ lockBlueprintContentEnabled = _this$props2.lockBlueprintContentEnabled;
84
+ return lockBlueprintContentEnabled && isContentLockedByBlueprint;
85
+ }
78
86
  }, {
79
87
  key: "renderChildQuizEntries",
80
88
  value: function renderChildQuizEntries() {
@@ -89,7 +97,7 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
89
97
  key: childEntry.id
90
98
  }, /*#__PURE__*/React.createElement(ConnectedQuizEntry, Object.assign({}, _this2.props.propsForQuizEntry(childEntry, displayPosition), {
91
99
  stimulusOrientation: _this2.props.stimulusOrientationEnabled ? _this2.props.stimulus.orientation : null
92
- })), !_this2.props.draggingOnBuild && /*#__PURE__*/React.createElement(AddContentPopover, {
100
+ })), !_this2.props.draggingOnBuild && !_this2.isQuizContentLocked() && /*#__PURE__*/React.createElement(AddContentPopover, {
93
101
  allowStimulusCreation: false,
94
102
  stimulusId: _this2.props.stimulus.id,
95
103
  parentEntryId: _this2.props.quizEntry.id,
@@ -123,7 +131,8 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
123
131
  switchOnEditing: this.props.switchOnEditing,
124
132
  switchOffEditing: this.props.switchOffEditing,
125
133
  onEditToggle: this.props.onEditStimulusToggle,
126
- shouldFocusOnMount: this.props.editStimulusToggle
134
+ shouldFocusOnMount: this.props.editStimulusToggle,
135
+ isQuizContentLocked: this.isQuizContentLocked()
127
136
  })));
128
137
  }
129
138
  }, {
@@ -131,9 +140,9 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
131
140
  value: function renderPanels(propsForDnDZone) {
132
141
  var _classnames2;
133
142
 
134
- var _this$props2 = this.props,
135
- stimulus = _this$props2.stimulus,
136
- stimulusOrientationEnabled = _this$props2.stimulusOrientationEnabled;
143
+ var _this$props3 = this.props,
144
+ stimulus = _this$props3.stimulus,
145
+ stimulusOrientationEnabled = _this$props3.stimulusOrientationEnabled;
137
146
  var shouldSetHorizontalOrientation = stimulus.orientation === LEFT || !stimulusOrientationEnabled;
138
147
  var stimulusPanelClass = classnames(styles.leftPanel, _defineProperty({}, styles.horizontallyAligned, shouldSetHorizontalOrientation));
139
148
  var itemsPanelClass = classnames((_classnames2 = {}, _defineProperty(_classnames2, styles.horizontallyAligned, shouldSetHorizontalOrientation), _defineProperty(_classnames2, styles.hidden, stimulus.isTemporary()), _defineProperty(_classnames2, styles.rightPanel, !stimulus.isTemporary()), _classnames2));
@@ -147,7 +156,7 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
147
156
  className: itemsPanelClass
148
157
  }, /*#__PURE__*/React.createElement("div", null), this.renderChildQuizEntries(), /*#__PURE__*/React.createElement(DragAndDropZone, Object.assign({}, propsForDnDZone, {
149
158
  location: "in"
150
- })), this.props.childEntries.size === 0 && /*#__PURE__*/React.createElement(AddContentPopover, {
159
+ })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && /*#__PURE__*/React.createElement(AddContentPopover, {
151
160
  allowStimulusCreation: false,
152
161
  stimulusId: this.props.stimulus.id,
153
162
  parentEntryId: this.props.quizEntry.id,
@@ -189,8 +198,10 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
189
198
  dropIntoEmptyStimulus: PropTypes.bool,
190
199
  displayPosition: PropTypes.number.isRequired,
191
200
  isBankedContent: PropTypes.bool,
201
+ isContentLockedByBlueprint: PropTypes.bool.isRequired,
192
202
  isEditing: PropTypes.bool,
193
203
  guid: PropTypes.string.isRequired,
204
+ lockBlueprintContentEnabled: PropTypes.bool.isRequired,
194
205
  openDeleteStimulusModal: PropTypes.func.isRequired,
195
206
  propsForQuizEntry: PropTypes.func.isRequired,
196
207
  quizEntry: ImmutablePropTypes.record.isRequired,
@@ -215,7 +226,9 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
215
226
  dropIntoEmptyStimulus: false,
216
227
  isBankedContent: false,
217
228
  isEditing: false,
229
+ lockBlueprintContentEnabled: false,
218
230
  onEditStimulusToggle: function onEditStimulusToggle() {},
219
- scrollKey: ''
231
+ scrollKey: '',
232
+ isContentLockedByBlueprint: false
220
233
  }, _temp)) || _class);
221
234
  export default DragSource(ItemTypes.QUIZ_ENTRY, dragSource, collectDrag)(wrapWithOutsideClick(Stimulus));
@@ -66,7 +66,8 @@ export var StimulusShow = (_dec = themeable(theme, styles), _dec(_class = (_temp
66
66
  return /*#__PURE__*/React.createElement(Overlay, {
67
67
  onClick: this.switchOnEditing,
68
68
  wrapperClassName: styles.stimulusWrapper,
69
- tabIndex: "-1"
69
+ tabIndex: "-1",
70
+ hideOverlay: this.props.isQuizContentLocked
70
71
  }, /*#__PURE__*/React.createElement("div", {
71
72
  className: styles.stimulus
72
73
  }, /*#__PURE__*/React.createElement("div", {
@@ -84,10 +85,13 @@ export var StimulusShow = (_dec = themeable(theme, styles), _dec(_class = (_temp
84
85
  scrollKey: this.props.scrollKey,
85
86
  shouldDisableDragHandle: this.props.shouldDisableDragHandle,
86
87
  switchOnEditing: this.props.switchOnEditing,
87
- shouldFocusOnMount: this.props.shouldFocusOnMount
88
+ shouldFocusOnMount: this.props.shouldFocusOnMount,
89
+ shouldDisableCopy: this.props.isQuizContentLocked,
90
+ shouldRenderEdit: !this.props.isQuizContentLocked,
91
+ shouldRenderDelete: !this.props.isQuizContentLocked
88
92
  })), /*#__PURE__*/React.createElement("div", {
89
93
  role: "presentation",
90
- onClick: this.switchOnEditing,
94
+ onClick: this.props.isQuizContentLocked ? null : this.switchOnEditing,
91
95
  className: styles.stimulusContent
92
96
  }, /*#__PURE__*/React.createElement(StimulusShowInfo, {
93
97
  stimulus: this.props.stimulus
@@ -101,6 +105,7 @@ export var StimulusShow = (_dec = themeable(theme, styles), _dec(_class = (_temp
101
105
  connectDragSource: PropTypes.func.isRequired,
102
106
  displayPosition: PropTypes.number.isRequired,
103
107
  isBankedContent: PropTypes.bool,
108
+ isQuizContentLocked: PropTypes.bool.isRequired,
104
109
  openDeleteStimulusModal: PropTypes.func.isRequired,
105
110
  quizEntries: ImmutablePropTypes.listOf(ImmutablePropTypes.record).isRequired,
106
111
  quizEntry: ImmutablePropTypes.record.isRequired,
@@ -111,6 +116,7 @@ export var StimulusShow = (_dec = themeable(theme, styles), _dec(_class = (_temp
111
116
  shouldFocusOnMount: PropTypes.bool.isRequired
112
117
  }, _class2.defaultProps = {
113
118
  isBankedContent: false,
119
+ isQuizContentLocked: false,
114
120
  scrollKey: '',
115
121
  shouldDisableDragHandle: false,
116
122
  shouldFocusOnMount: false
@@ -149,7 +149,7 @@ var ActionButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
149
149
  quizEntry: this.props.quizEntry,
150
150
  quizEntries: this.props.quizEntries,
151
151
  disabled: this.props.shouldDisableDragHandle
152
- }))), /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
152
+ }))), this.props.shouldRenderDelete && /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
153
153
  as: "div",
154
154
  onClick: this.props.onDelete,
155
155
  disabled: this.props.shouldDisableDeleteButton,
@@ -176,6 +176,7 @@ var ActionButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
176
176
  shouldDisableDragHandle: _propTypes.default.bool,
177
177
  shouldDisableDeleteButton: _propTypes.default.bool,
178
178
  shouldRenderEdit: _propTypes.default.bool,
179
+ shouldRenderDelete: _propTypes.default.bool,
179
180
  switchOnEditing: _propTypes.default.func,
180
181
  shouldFocusOnMount: _propTypes.default.bool
181
182
  }, _class2.defaultProps = {
@@ -218,7 +218,7 @@ var QuizEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
218
218
  clearValidationErrorsFromApi: this.props.clearValidationErrorsFromApi,
219
219
  haveValidationErrorsFromApi: Boolean(Object.values(this.props.validationErrorsFromApi).length),
220
220
  useNewRce: (0, _rceChecker.isNewRCEEnabled)()
221
- }, (0, _pick.default)(this.props, ['displayPosition', 'guid', 'draggingOnBuild', 'newHoverPosition', 'quizEntry', 'quizEntries', 'quizId', 'setUi', 'switchOffEditing', 'switchOnEditing', 'shouldClone', 'scrollKey', 'editQuizEntryToggle', 'onEditQuizEntryToggle', 'stimulusOrientation']));
221
+ }, (0, _pick.default)(this.props, ['displayPosition', 'guid', 'draggingOnBuild', 'newHoverPosition', 'quizEntry', 'quizEntries', 'quizId', 'isContentLockedByBlueprint', 'setUi', 'switchOffEditing', 'switchOnEditing', 'shouldClone', 'scrollKey', 'editQuizEntryToggle', 'onEditQuizEntryToggle', 'stimulusOrientation']));
222
222
  }
223
223
  }, {
224
224
  key: "isEditing",
@@ -304,6 +304,7 @@ var QuizEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
304
304
  dndRef: this.storeDndComponentRef,
305
305
  guid: this.props.guid,
306
306
  isBankedContent: bankEntryWarningWrapperProps !== void 0,
307
+ isContentLockedByBlueprint: this.props.isContentLockedByBlueprint,
307
308
  isEditing: this.isEditing(),
308
309
  draggingOnBuild: this.props.draggingOnBuild,
309
310
  newHoverPosition: this.props.newHoverPosition // used for DnD
@@ -399,6 +400,7 @@ var QuizEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
399
400
  quizEntries: _reactImmutableProptypes.default.listOf(_reactImmutableProptypes.default.record).isRequired,
400
401
  quizEntry: _reactImmutableProptypes.default.record.isRequired,
401
402
  quizId: _propTypes.default.string.isRequired,
403
+ isContentLockedByBlueprint: _propTypes.default.bool.isRequired,
402
404
  regradingOn: _propTypes.default.bool.isRequired,
403
405
  screenreaderNotification: _propTypes.default.func.isRequired,
404
406
  scrollKey: _propTypes.default.string,
@@ -425,6 +427,7 @@ var QuizEntry = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
425
427
  draggingOnBuild: false,
426
428
  draggingOver: false,
427
429
  initialFocusId: null,
430
+ isContentLockedByBlueprint: false,
428
431
  isEditing: false,
429
432
  partialDeepScoringEnabled: false,
430
433
  partialScoringEnabled: false,
@@ -41,6 +41,7 @@ function mapStateToProps(state, props) {
41
41
  modificationsClear: itemModsClear && quizEntryModsClear,
42
42
  quizEntryWithErrorsShowing: (0, _quizzes.getQuizEntryWithErrorsShowing)(state) || props.haveValidationErrorsFromApi,
43
43
  richFITBEnabled: (0, _featureCheck.featureOn)('interaction_type_rich_fill_blank'),
44
+ lockBlueprintContentEnabled: (0, _featureCheck.featureOn)('lock_blueprint_content'),
44
45
  richFITBInteractionID: (richFITBInteraction || (0, _immutable.Map)()).get('id'),
45
46
  updateItemCallStatus: state.getIn(['calls', _quizCommon.UPDATE_ITEM_CALL, 'requestStatus'], '')
46
47
  };
@@ -296,7 +296,9 @@ var QuizEntryShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
296
296
  draggingOver = _this$props2.draggingOver,
297
297
  draggingAboveHalf = _this$props2.draggingAboveHalf,
298
298
  quizEntry = _this$props2.quizEntry,
299
- stimulusOrientation = _this$props2.stimulusOrientation;
299
+ stimulusOrientation = _this$props2.stimulusOrientation,
300
+ isContentLockedByBlueprint = _this$props2.isContentLockedByBlueprint,
301
+ lockBlueprintContentEnabled = _this$props2.lockBlueprintContentEnabled;
300
302
  var positionToDisplay = this.props.quizEntry.positionToDisplay(displayPosition);
301
303
  var positionText = (0, _formatMessage.default)('Preview of question at position {position}', {
302
304
  position: positionToDisplay
@@ -305,13 +307,15 @@ var QuizEntryShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
305
307
  var propsForDnDZone = {
306
308
  draggingOver: draggingOver,
307
309
  draggingAboveHalf: draggingAboveHalf
308
- }; // Overlay gets tabIndex === "-1" so that the drag handle is tabbable before
310
+ };
311
+ var shouldLockQuizEntry = lockBlueprintContentEnabled && isContentLockedByBlueprint; // Overlay gets tabIndex === "-1" so that the drag handle is tabbable before
309
312
  // the Overlay get focus and opens the quizEntry in edit mode
310
313
 
311
314
  return /*#__PURE__*/_react.default.createElement(_Overlay.default, {
312
315
  onClick: this.editingOn,
313
316
  wrapperClassName: styles.quizEntryWrapper,
314
- tabIndex: "-1"
317
+ tabIndex: "-1",
318
+ hideOverlay: shouldLockQuizEntry
315
319
  }, /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({}, propsForDnDZone, {
316
320
  location: "above"
317
321
  })), connectDragPreview( /*#__PURE__*/_react.default.createElement("div", {
@@ -336,7 +340,10 @@ var QuizEntryShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
336
340
  scrollKey: this.props.scrollKey,
337
341
  shouldDisableDragHandle: this.shouldDisableDragHandle(),
338
342
  switchOnEditing: this.editingOn,
339
- shouldFocusOnMount: this.props.editQuizEntryToggle
343
+ shouldFocusOnMount: this.props.editQuizEntryToggle,
344
+ shouldDisableCopy: shouldLockQuizEntry,
345
+ shouldRenderEdit: !shouldLockQuizEntry,
346
+ shouldRenderDelete: !shouldLockQuizEntry
340
347
  }), /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, srMsg)), /*#__PURE__*/_react.default.createElement("div", {
341
348
  className: styles.itemHolder,
342
349
  ref: this.setInert,
@@ -363,10 +370,12 @@ var QuizEntryShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
363
370
  // only used in index.js
364
371
  interactionTypeName: _propTypes.default.string,
365
372
  modificationsClear: _propTypes.default.bool.isRequired,
373
+ lockBlueprintContentEnabled: _propTypes.default.bool.isRequired,
366
374
  quizEntryWithErrorsShowing: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
367
375
  quizEntries: _reactImmutableProptypes.default.listOf(_reactImmutableProptypes.default.record).isRequired,
368
376
  quizEntry: _reactImmutableProptypes.default.record.isRequired,
369
377
  quizId: _propTypes.default.string.isRequired,
378
+ isContentLockedByBlueprint: _propTypes.default.bool.isRequired,
370
379
  removeQuizEntry: _propTypes.default.func.isRequired,
371
380
  // from connected component
372
381
  richFITBEnabled: _propTypes.default.bool,
@@ -383,11 +392,13 @@ var QuizEntryShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
383
392
  children: null,
384
393
  draggingOver: false,
385
394
  draggingAboveHalf: false,
395
+ lockBlueprintContentEnabled: false,
386
396
  quizEntryWithErrorsShowing: null,
387
397
  scrollKey: void 0,
388
398
  editQuizEntryToggle: false,
389
399
  haveValidationErrorsFromApi: false,
390
400
  interactionTypeName: null,
401
+ isContentLockedByBlueprint: false,
391
402
  richFITBEnabled: false,
392
403
  richFITBInteractionID: '',
393
404
  stimulusOrientation: null
@@ -29,6 +29,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
29
29
  dropIntoEmptyStimulus: draggingOver && dropIntoEmptyStimulus,
30
30
  draggingOver: draggingOver,
31
31
  draggingAboveHalf: draggingOver && draggingAboveHalf,
32
+ lockBlueprintContentEnabled: (0, _featureCheck.featureOn)('lock_blueprint_content'),
32
33
  stimulusOrientationEnabled: (0, _featureCheck.featureOn)('customizable_stimulus_orientation')
33
34
  };
34
35
  };
@@ -106,6 +106,14 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
106
106
  quizEntry = _this$props.quizEntry;
107
107
  return quizEntries.size === quizEntry.positionSlots + 1;
108
108
  }
109
+ }, {
110
+ key: "isQuizContentLocked",
111
+ value: function isQuizContentLocked() {
112
+ var _this$props2 = this.props,
113
+ isContentLockedByBlueprint = _this$props2.isContentLockedByBlueprint,
114
+ lockBlueprintContentEnabled = _this$props2.lockBlueprintContentEnabled;
115
+ return lockBlueprintContentEnabled && isContentLockedByBlueprint;
116
+ }
109
117
  }, {
110
118
  key: "renderChildQuizEntries",
111
119
  value: function renderChildQuizEntries() {
@@ -120,7 +128,7 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
120
128
  key: childEntry.id
121
129
  }, /*#__PURE__*/_react.default.createElement(_index5.default, Object.assign({}, _this2.props.propsForQuizEntry(childEntry, displayPosition), {
122
130
  stimulusOrientation: _this2.props.stimulusOrientationEnabled ? _this2.props.stimulus.orientation : null
123
- })), !_this2.props.draggingOnBuild && /*#__PURE__*/_react.default.createElement(_index.default, {
131
+ })), !_this2.props.draggingOnBuild && !_this2.isQuizContentLocked() && /*#__PURE__*/_react.default.createElement(_index.default, {
124
132
  allowStimulusCreation: false,
125
133
  stimulusId: _this2.props.stimulus.id,
126
134
  parentEntryId: _this2.props.quizEntry.id,
@@ -154,7 +162,8 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
154
162
  switchOnEditing: this.props.switchOnEditing,
155
163
  switchOffEditing: this.props.switchOffEditing,
156
164
  onEditToggle: this.props.onEditStimulusToggle,
157
- shouldFocusOnMount: this.props.editStimulusToggle
165
+ shouldFocusOnMount: this.props.editStimulusToggle,
166
+ isQuizContentLocked: this.isQuizContentLocked()
158
167
  })));
159
168
  }
160
169
  }, {
@@ -162,9 +171,9 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
162
171
  value: function renderPanels(propsForDnDZone) {
163
172
  var _classnames2;
164
173
 
165
- var _this$props2 = this.props,
166
- stimulus = _this$props2.stimulus,
167
- stimulusOrientationEnabled = _this$props2.stimulusOrientationEnabled;
174
+ var _this$props3 = this.props,
175
+ stimulus = _this$props3.stimulus,
176
+ stimulusOrientationEnabled = _this$props3.stimulusOrientationEnabled;
168
177
  var shouldSetHorizontalOrientation = stimulus.orientation === _quizCommon.LEFT || !stimulusOrientationEnabled;
169
178
  var stimulusPanelClass = (0, _classnames4.default)(styles.leftPanel, (0, _defineProperty2.default)({}, styles.horizontallyAligned, shouldSetHorizontalOrientation));
170
179
  var itemsPanelClass = (0, _classnames4.default)((_classnames2 = {}, (0, _defineProperty2.default)(_classnames2, styles.horizontallyAligned, shouldSetHorizontalOrientation), (0, _defineProperty2.default)(_classnames2, styles.hidden, stimulus.isTemporary()), (0, _defineProperty2.default)(_classnames2, styles.rightPanel, !stimulus.isTemporary()), _classnames2));
@@ -178,7 +187,7 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
178
187
  className: itemsPanelClass
179
188
  }, /*#__PURE__*/_react.default.createElement("div", null), this.renderChildQuizEntries(), /*#__PURE__*/_react.default.createElement(_index4.default, Object.assign({}, propsForDnDZone, {
180
189
  location: "in"
181
- })), this.props.childEntries.size === 0 && /*#__PURE__*/_react.default.createElement(_index.default, {
190
+ })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && /*#__PURE__*/_react.default.createElement(_index.default, {
182
191
  allowStimulusCreation: false,
183
192
  stimulusId: this.props.stimulus.id,
184
193
  parentEntryId: this.props.quizEntry.id,
@@ -219,8 +228,10 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
219
228
  dropIntoEmptyStimulus: _propTypes.default.bool,
220
229
  displayPosition: _propTypes.default.number.isRequired,
221
230
  isBankedContent: _propTypes.default.bool,
231
+ isContentLockedByBlueprint: _propTypes.default.bool.isRequired,
222
232
  isEditing: _propTypes.default.bool,
223
233
  guid: _propTypes.default.string.isRequired,
234
+ lockBlueprintContentEnabled: _propTypes.default.bool.isRequired,
224
235
  openDeleteStimulusModal: _propTypes.default.func.isRequired,
225
236
  propsForQuizEntry: _propTypes.default.func.isRequired,
226
237
  quizEntry: _reactImmutableProptypes.default.record.isRequired,
@@ -245,8 +256,10 @@ var Stimulus = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec
245
256
  dropIntoEmptyStimulus: false,
246
257
  isBankedContent: false,
247
258
  isEditing: false,
259
+ lockBlueprintContentEnabled: false,
248
260
  onEditStimulusToggle: function onEditStimulusToggle() {},
249
- scrollKey: ''
261
+ scrollKey: '',
262
+ isContentLockedByBlueprint: false
250
263
  }, _temp)) || _class);
251
264
  exports.Stimulus = Stimulus;
252
265
 
@@ -89,7 +89,8 @@ var StimulusShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
89
89
  return /*#__PURE__*/_react.default.createElement(_Overlay.default, {
90
90
  onClick: this.switchOnEditing,
91
91
  wrapperClassName: styles.stimulusWrapper,
92
- tabIndex: "-1"
92
+ tabIndex: "-1",
93
+ hideOverlay: this.props.isQuizContentLocked
93
94
  }, /*#__PURE__*/_react.default.createElement("div", {
94
95
  className: styles.stimulus
95
96
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -107,10 +108,13 @@ var StimulusShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
107
108
  scrollKey: this.props.scrollKey,
108
109
  shouldDisableDragHandle: this.props.shouldDisableDragHandle,
109
110
  switchOnEditing: this.props.switchOnEditing,
110
- shouldFocusOnMount: this.props.shouldFocusOnMount
111
+ shouldFocusOnMount: this.props.shouldFocusOnMount,
112
+ shouldDisableCopy: this.props.isQuizContentLocked,
113
+ shouldRenderEdit: !this.props.isQuizContentLocked,
114
+ shouldRenderDelete: !this.props.isQuizContentLocked
111
115
  })), /*#__PURE__*/_react.default.createElement("div", {
112
116
  role: "presentation",
113
- onClick: this.switchOnEditing,
117
+ onClick: this.props.isQuizContentLocked ? null : this.switchOnEditing,
114
118
  className: styles.stimulusContent
115
119
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
116
120
  stimulus: this.props.stimulus
@@ -123,6 +127,7 @@ var StimulusShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
123
127
  connectDragSource: _propTypes.default.func.isRequired,
124
128
  displayPosition: _propTypes.default.number.isRequired,
125
129
  isBankedContent: _propTypes.default.bool,
130
+ isQuizContentLocked: _propTypes.default.bool.isRequired,
126
131
  openDeleteStimulusModal: _propTypes.default.func.isRequired,
127
132
  quizEntries: _reactImmutableProptypes.default.listOf(_reactImmutableProptypes.default.record).isRequired,
128
133
  quizEntry: _reactImmutableProptypes.default.record.isRequired,
@@ -133,6 +138,7 @@ var StimulusShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
133
138
  shouldFocusOnMount: _propTypes.default.bool.isRequired
134
139
  }, _class2.defaultProps = {
135
140
  isBankedContent: false,
141
+ isQuizContentLocked: false,
136
142
  scrollKey: '',
137
143
  shouldDisableDragHandle: false,
138
144
  shouldFocusOnMount: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.41.1-rc.11+b7926183d",
3
+ "version": "17.41.1-rc.13+deb056816",
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.41.1-rc.11+b7926183d",
45
- "@instructure/quiz-i18n": "17.41.1-rc.11+b7926183d",
46
- "@instructure/quiz-interactions": "17.41.1-rc.11+b7926183d",
47
- "@instructure/quiz-number-input": "17.41.1-rc.11+b7926183d",
48
- "@instructure/quiz-rce": "17.41.1-rc.11+b7926183d",
44
+ "@instructure/quiz-common": "17.41.1-rc.13+deb056816",
45
+ "@instructure/quiz-i18n": "17.41.1-rc.13+deb056816",
46
+ "@instructure/quiz-interactions": "17.41.1-rc.13+deb056816",
47
+ "@instructure/quiz-number-input": "17.41.1-rc.13+deb056816",
48
+ "@instructure/quiz-rce": "17.41.1-rc.13+deb056816",
49
49
  "@instructure/ui-a11y-content": "^7.20.0",
50
50
  "@instructure/ui-alerts": "^7.20.0",
51
51
  "@instructure/ui-avatar": "^7.20.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.41.1-rc.11+b7926183d",
109
+ "instructure-validations": "17.41.1-rc.13+deb056816",
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.41.1-rc.11+b7926183d",
140
+ "@instructure/quiz-scripts": "17.41.1-rc.13+deb056816",
141
141
  "@instructure/ui-axe-check": "^7.20.0",
142
142
  "@instructure/ui-babel-preset": "^7.20.0",
143
143
  "@instructure/ui-karma-config": "^7.20.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.41.1-rc.11+b7926183d",
159
+ "quiz-presets": "17.41.1-rc.13+deb056816",
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": "b7926183d2ec243e49fca7549b86308e23384390"
175
+ "gitHead": "deb0568160dae9096a4efc24a2632d68d2348497"
176
176
  }