@instructure/quiz-core 22.1.0 → 22.2.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.
Files changed (37) hide show
  1. package/es/banks/components/AddBankEntryModal/presenter.js +4 -1
  2. package/es/banks/components/BankEntry/presenter.js +110 -12
  3. package/es/banks/components/BankEntryRow/presenter.js +52 -8
  4. package/es/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
  5. package/es/common/components/layout/sidebar/Stimulus/Collection/presenter.js +2 -2
  6. package/es/common/components/layout/sidebar/Stimulus/presenter.js +9 -6
  7. package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
  8. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +11 -10
  9. package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +5 -5
  10. package/es/common/components/resources/stimulus/StimulusShow/index.js +1 -1
  11. package/es/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
  12. package/es/common/components/shared/InteractionTypes/presenter.js +3 -2
  13. package/es/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
  14. package/es/common/records/BankEntry.js +9 -1
  15. package/es/common/records/QuizEntry.js +1 -1
  16. package/es/common/reducers/modifications.js +21 -12
  17. package/es/common/util/warningHelpers.js +13 -3
  18. package/es/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
  19. package/lib/banks/components/AddBankEntryModal/presenter.js +4 -1
  20. package/lib/banks/components/BankEntry/presenter.js +110 -12
  21. package/lib/banks/components/BankEntryRow/presenter.js +52 -8
  22. package/lib/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
  23. package/lib/common/components/layout/sidebar/Stimulus/Collection/presenter.js +2 -2
  24. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +9 -6
  25. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
  26. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +11 -10
  27. package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +5 -5
  28. package/lib/common/components/resources/stimulus/StimulusShow/index.js +1 -1
  29. package/lib/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
  30. package/lib/common/components/shared/InteractionTypes/presenter.js +3 -2
  31. package/lib/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
  32. package/lib/common/records/BankEntry.js +9 -1
  33. package/lib/common/records/QuizEntry.js +1 -1
  34. package/lib/common/reducers/modifications.js +21 -12
  35. package/lib/common/util/warningHelpers.js +13 -3
  36. package/lib/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
  37. package/package.json +9 -9
@@ -53,7 +53,10 @@ export var AddBankEntryModal = /*#__PURE__*/function (_Component) {
53
53
  _this2.props.navigateToBankEntry('new', _this2.props.bankId);
54
54
  });
55
55
  _defineProperty(_this2, "addStimulus", function () {
56
- _this2.props.createBankItem(_this2.props.bankId, 'Stimulus');
56
+ var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
57
+ _this2.props.createBankItem(_this2.props.bankId, 'Stimulus', {
58
+ passage: isPassage
59
+ });
57
60
  _this2.closeAction();
58
61
  _this2.props.navigateToBankEntry('new', _this2.props.bankId);
59
62
  });
@@ -233,18 +233,69 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
233
233
  value: function isTemporary() {
234
234
  return this.props.entry && this.props.entry.isTemporary();
235
235
  }
236
+ }, {
237
+ key: "getBankEntryTypeSlug",
238
+ value: function getBankEntryTypeSlug() {
239
+ return this.props.bankEntry.entryType;
240
+ }
241
+ }, {
242
+ key: "getEntry",
243
+ value: function getEntry() {
244
+ return this.props.entry;
245
+ }
236
246
  }, {
237
247
  key: "isItemEntry",
238
248
  value: function isItemEntry() {
239
249
  return this.props.bankEntry.entryType === 'Item';
240
250
  }
251
+ }, {
252
+ key: "isStimulusEntry",
253
+ value: function isStimulusEntry() {
254
+ var entry = this.getEntry();
255
+ if (!entry) return false;
256
+ return entry.isStimulus && !entry.isPassage;
257
+ }
258
+ }, {
259
+ key: "isPassageEntry",
260
+ value: function isPassageEntry() {
261
+ var entry = this.getEntry();
262
+ if (!entry) return false;
263
+ return entry.isStimulus && entry.isPassage;
264
+ }
265
+ }, {
266
+ key: "getEditWarning",
267
+ value: function getEditWarning() {
268
+ if (this.isStimulusEntry()) {
269
+ return t('Edits made here will appear on any assessment using this stimulus.');
270
+ }
271
+ if (this.isPassageEntry()) {
272
+ return t('Edits made here will appear on any assessment using this text block.');
273
+ }
274
+ return t('Edits made here will appear on any assessment using this question.');
275
+ }
241
276
  }, {
242
277
  key: "entryLinkName",
243
278
  value: function entryLinkName() {
244
- if (this.isTemporary()) {
245
- return this.isItemEntry() ? t('New Question') : t('New Stimulus');
246
- } else {
247
- return this.isItemEntry() ? t('Edit Question') : t('Edit Stimulus');
279
+ var translations = {
280
+ "new": {
281
+ question: t('New Question'),
282
+ stimulus: t('New Stimulus'),
283
+ passage: t('New Text Block')
284
+ },
285
+ edit: {
286
+ question: t('Edit Question'),
287
+ stimulus: t('Edit Stimulus'),
288
+ passage: t('Edit Text Block')
289
+ }
290
+ };
291
+ var operation = this.isTemporary() ? 'new' : 'edit';
292
+ switch (true) {
293
+ case this.isItemEntry():
294
+ return translations[operation]['question'];
295
+ case this.isStimulusEntry():
296
+ return translations[operation]['stimulus'];
297
+ case this.isPassageEntry():
298
+ return translations[operation]['passage'];
248
299
  }
249
300
  }
250
301
  }, {
@@ -297,19 +348,66 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
297
348
  });
298
349
  }
299
350
  }
351
+ }, {
352
+ key: "getIdentifier",
353
+ value: function getIdentifier(entry) {
354
+ if (!entry) return;
355
+ switch (true) {
356
+ case this.isItemEntry():
357
+ return t('Question { id }', {
358
+ id: entry.id
359
+ });
360
+ case this.isStimulusEntry():
361
+ return t('Stimulus { id }', {
362
+ id: entry.id
363
+ });
364
+ case this.isPassageEntry():
365
+ return t('Text Block { id }', {
366
+ id: entry.id
367
+ });
368
+ default:
369
+ return;
370
+ }
371
+ }
372
+ }, {
373
+ key: "getTemporaryIdentifier",
374
+ value: function getTemporaryIdentifier() {
375
+ switch (true) {
376
+ case this.isItemEntry():
377
+ return t('New Question');
378
+ case this.isStimulusEntry():
379
+ return t('New Stimulus');
380
+ case this.isPassageEntry():
381
+ return t('New Text Block');
382
+ default:
383
+ return;
384
+ }
385
+ }
386
+ }, {
387
+ key: "getEntryName",
388
+ value: function getEntryName(entry) {
389
+ var _entry$getInteraction;
390
+ if (!entry) return;
391
+ switch (true) {
392
+ case this.isItemEntry():
393
+ return (_entry$getInteraction = entry.getInteractionType()) === null || _entry$getInteraction === void 0 ? void 0 : _entry$getInteraction.name;
394
+ case this.isStimulusEntry():
395
+ return t('Stimulus');
396
+ case this.isPassageEntry():
397
+ return t('Text Block');
398
+ default:
399
+ return;
400
+ }
401
+ }
300
402
  }, {
301
403
  key: "renderHeader",
302
404
  value: function renderHeader(entry) {
303
405
  if (!entry) return;
304
406
  var props = this.editProps(entry);
305
- var identifier = this.isItemEntry() ? t('Question { id }', {
306
- id: entry.id
307
- }) : t('Stimulus { id }', {
308
- id: entry.id
309
- });
310
- var tempIdentifier = this.isItemEntry() ? t('New Question') : t('New Stimulus');
407
+ var identifier = this.getIdentifier(entry);
408
+ var tempIdentifier = this.getTemporaryIdentifier();
311
409
  var itemIdentifier = this.isTemporary() ? tempIdentifier : identifier;
312
- var entryName = this.isItemEntry() ? entry.getInteractionType().name : t('Stimulus');
410
+ var entryName = this.getEntryName(entry);
313
411
  var separator = ' | ';
314
412
  return jsx("div", {
315
413
  css: this.props.styles.header
@@ -543,7 +641,7 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
543
641
  tags: _this3.visibleTags()
544
642
  });
545
643
  };
546
- var editWarning = this.isItemEntry() ? t('Edits made here will appear on any assessment using this question.') : t('Edits made here will appear on any assessment using this stimulus.');
644
+ var editWarning = this.getEditWarning();
547
645
  return jsx("div", null, jsx("div", {
548
646
  css: this.props.styles.entryEdit
549
647
  }, jsx(WarningWrapper, versioningProps, canEdit && jsx(Alert, {
@@ -58,7 +58,6 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
58
58
  _this2.props.setUi(BUILD_TRAY_POSITION, _this2.props.position + 1);
59
59
  });
60
60
  _defineProperty(_this2, "deleteBankEntry", function () {
61
- var deletePreface = _this2.isItemEntry() ? t('Deleting this question:') : t('Deleting this stimulus:');
62
61
  var confirmBody = jsx(Alert, {
63
62
  variant: "error",
64
63
  padding: "0"
@@ -66,7 +65,7 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
66
65
  css: _this2.props.styles.deleteAlert
67
66
  }, jsx("div", {
68
67
  css: _this2.props.styles.deletePreface
69
- }, deletePreface), jsx(List, null, jsx(List.Item, null, t.rich('will <0>NOT</0> remove it from any assessments', [function (_ref) {
68
+ }, _this2.getDeletePreface()), jsx(List, null, jsx(List.Item, null, t.rich('will <0>NOT</0> remove it from any assessments', [function (_ref) {
70
69
  var children = _ref.children;
71
70
  return jsx(Text, {
72
71
  weight: "bold",
@@ -152,20 +151,60 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
152
151
  value: function isItemEntry() {
153
152
  return this.props.bankEntry.entryType === 'Item';
154
153
  }
154
+ }, {
155
+ key: "isStimulusEntry",
156
+ value: function isStimulusEntry() {
157
+ var entry = this.getEntry();
158
+ if (!entry) return false;
159
+ return entry.isStimulus && !entry.isPassage;
160
+ }
161
+ }, {
162
+ key: "isPassageEntry",
163
+ value: function isPassageEntry() {
164
+ var entry = this.getEntry();
165
+ if (!entry) return false;
166
+ return entry.isStimulus && entry.isPassage;
167
+ }
155
168
  }, {
156
169
  key: "type",
157
170
  value: function type() {
158
- return this.isItemEntry() ? t('Question') : t('Stimulus');
171
+ if (this.isStimulusEntry()) {
172
+ return t('Stimulus');
173
+ }
174
+ if (this.isPassageEntry()) {
175
+ return t('Text Block');
176
+ }
177
+ return t('Question');
159
178
  }
160
179
  }, {
161
180
  key: "entryIdentifier",
162
181
  value: function entryIdentifier() {
163
- return this.isItemEntry() ? t('Question { itemBody }', {
164
- itemBody: extractTextFromHtml(this.getEntry().title)
165
- }) : t('Stimulus { title }', {
166
- title: this.getEntry().title
182
+ var title = this.getEntry().title;
183
+ if (this.isStimulusEntry()) {
184
+ return t('Stimulus { title }', {
185
+ title: title
186
+ });
187
+ }
188
+ if (this.isPassageEntry()) {
189
+ return t('Text Block { title }', {
190
+ title: title
191
+ });
192
+ }
193
+ return t('Question { itemBody }', {
194
+ itemBody: extractTextFromHtml(title)
167
195
  });
168
196
  }
197
+ }, {
198
+ key: "getDeletePreface",
199
+ value: function getDeletePreface() {
200
+ if (this.isStimulusEntry()) {
201
+ return t('Deleting this stimulus:');
202
+ }
203
+ if (this.isPassageEntry()) {
204
+ return t('Deleting this text block:');
205
+ }
206
+ return t('Deleting this question:');
207
+ }
169
208
  }, {
170
209
  key: "moveModalTitle",
171
210
  value: function moveModalTitle() {
@@ -234,7 +273,12 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
234
273
  }, {
235
274
  key: "entryHeader",
236
275
  value: function entryHeader() {
237
- return this.isItemEntry() ? this.getEntry().getInteractionType().name : t('Stimulus');
276
+ var entry = this.getEntry();
277
+ if (this.isItemEntry()) {
278
+ return entry.getInteractionType().name;
279
+ } else {
280
+ return entry.isPassage ? t('Text Block') : t('Stimulus');
281
+ }
238
282
  }
239
283
  }, {
240
284
  key: "renderHeader",
@@ -156,8 +156,14 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
156
156
  }, {
157
157
  key: "isPassage",
158
158
  value: function isPassage() {
159
- var _this$props$stimulusE;
160
- return (_this$props$stimulusE = this.props.stimulusEntry) === null || _this$props$stimulusE === void 0 ? void 0 : _this$props$stimulusE.getEntry().passage;
159
+ var _this$props$stimulusE, _this$props$stimulusE3;
160
+ if (((_this$props$stimulusE = this.props.stimulusEntry) === null || _this$props$stimulusE === void 0 ? void 0 : _this$props$stimulusE.entryType) === 'BankEntry') {
161
+ var _this$props$stimulusE2;
162
+ var bankEntry = (_this$props$stimulusE2 = this.props.stimulusEntry) === null || _this$props$stimulusE2 === void 0 ? void 0 : _this$props$stimulusE2.getEntry();
163
+ var stimulusEntry = bankEntry === null || bankEntry === void 0 ? void 0 : bankEntry.getEntry();
164
+ return stimulusEntry === null || stimulusEntry === void 0 ? void 0 : stimulusEntry.isPassage;
165
+ }
166
+ return (_this$props$stimulusE3 = this.props.stimulusEntry) === null || _this$props$stimulusE3 === void 0 ? void 0 : _this$props$stimulusE3.getEntry().passage;
161
167
  }
162
168
  }, {
163
169
  key: "anyImmutableKeepers",
@@ -188,7 +194,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
188
194
  onClick: this.closeAction,
189
195
  margin: XSMALL_SIDE_MARGIN,
190
196
  "data-automation": "sdk-keep-".concat(this.isPassage() ? 'passage' : 'stimulus', "-button")
191
- }, this.isPassage() ? t('Keep Passage') : t('Keep Stimulus'));
197
+ }, this.isPassage() ? t('Keep Text Block') : t('Keep Stimulus'));
192
198
  }
193
199
  }, {
194
200
  key: "doneButton",
@@ -198,7 +204,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
198
204
  onClick: this.handleSubmit,
199
205
  margin: XSMALL_SIDE_MARGIN,
200
206
  "data-automation": "sdk-remove-".concat(this.isPassage() ? 'passage' : 'stimulus', "-button")
201
- }, this.isPassage() ? t('Remove Passage') : t('Remove Stimulus'));
207
+ }, this.isPassage() ? t('Remove Text Block') : t('Remove Stimulus'));
202
208
  }
203
209
  }, {
204
210
  key: "renderChooseWhich",
@@ -241,7 +247,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
241
247
  }, {
242
248
  key: "renderContent",
243
249
  value: function renderContent() {
244
- var message = this.isPassage() ? t('Are you sure you want to remove this passage?') : t('Are you sure you want to remove this stimulus?');
250
+ var message = this.isPassage() ? t('Are you sure you want to remove this text block?') : t('Are you sure you want to remove this stimulus?');
245
251
  var content = this.props.childEntries.size === 0 ? jsx("span", null, message) : this.renderMainMenu();
246
252
  var stimulusTitle = this.props.stimulusEntry && this.props.stimulusEntry.getEntry().title;
247
253
  return jsx("div", {
@@ -258,11 +264,11 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
258
264
  open: this.props.modalOpen,
259
265
  onDismiss: this.closeAction,
260
266
  size: "small",
261
- label: this.isPassage() ? t('Confirm Passage Removal') : t('Confirm Stimulus Removal')
267
+ label: this.isPassage() ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal')
262
268
  }, jsx(ModalHeader, null, jsx(Heading, {
263
269
  level: "reset",
264
270
  as: "h2"
265
- }, this.isPassage() ? t('Confirm Passage Removal') : t('Confirm Stimulus Removal')), jsx(CloseButton, {
271
+ }, this.isPassage() ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal')), jsx(CloseButton, {
266
272
  onClick: this.closeAction,
267
273
  placement: "end",
268
274
  offset: "medium",
@@ -89,7 +89,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
89
89
  }, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
90
90
  });
91
91
  var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
92
- var screenReaderText = this.props.isPassage ? t('Collapse passage questions') : t('Collapse stimulus questions');
92
+ var screenReaderText = this.props.isPassage ? t('Collapse text block questions') : t('Collapse stimulus questions');
93
93
  return jsx(Transition, {
94
94
  "in": isShowingItems || this.shouldDisplayAllItems(),
95
95
  type: transitionType
@@ -112,7 +112,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
112
112
  itemCollection = _this$props2.itemCollection,
113
113
  isShowingItems = _this$props2.isShowingItems;
114
114
  var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
115
- var screenReaderText = this.props.isPassage ? t('Expand passage questions') : t('Expand stimulus questions');
115
+ var screenReaderText = this.props.isPassage ? t('Expand text block questions') : t('Expand stimulus questions');
116
116
  return jsx(Transition, {
117
117
  "in": !isShowingItems,
118
118
  type: transitionType
@@ -103,11 +103,14 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
103
103
  var _this$props2 = this.props,
104
104
  displayPosition = _this$props2.displayPosition,
105
105
  sidebarOpen = _this$props2.sidebarOpen;
106
- var itemName = this.stimulusIsPassage() ? 'passage' : 'stimulus';
107
- var textForNavigation = t('Navigate to {itemName} at position {displayPosition}', {
108
- itemName: itemName,
109
- displayPosition: displayPosition
110
- });
106
+ var textForNavigation;
107
+ if (this.stimulusIsPassage()) {
108
+ textForNavigation = t('Navigate to text block');
109
+ } else {
110
+ textForNavigation = t('Navigate to stimulus at position {displayPosition}', {
111
+ displayPosition: displayPosition
112
+ });
113
+ }
111
114
  var content = sidebarOpen ? '' : textForNavigation;
112
115
  var tip = jsx(Text, {
113
116
  "aria-hidden": !sidebarOpen,
@@ -131,7 +134,7 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
131
134
  }, {
132
135
  key: "infoHeaderLabel",
133
136
  value: function infoHeaderLabel() {
134
- return this.stimulusIsPassage() ? t('Passage') : t('Stimulus');
137
+ return this.stimulusIsPassage() ? t('Text Block') : t('Stimulus');
135
138
  }
136
139
  }, {
137
140
  key: "renderSummary",
@@ -114,7 +114,7 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
114
114
  key: "renderStimulusPanel",
115
115
  value: function renderStimulusPanel() {
116
116
  var StimulusComponent = this.props.isEditing ? StimulusEdit : StimulusShow;
117
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
117
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
118
118
  var connectDragPreview = this.props.connectDragPreview;
119
119
  return connectDragPreview(jsx("div", {
120
120
  "data-automation": "sdk-".concat(automationPrefix, "-LeftPanelShow")
@@ -142,7 +142,7 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
142
142
  }, {
143
143
  key: "renderPanels",
144
144
  value: function renderPanels(propsForDnDZone) {
145
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
145
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
146
146
  return jsx("div", {
147
147
  css: this.props.styles.stimulus,
148
148
  ref: this.props.dndRef,
@@ -80,11 +80,11 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
80
80
  inStimulus: false
81
81
  });
82
82
  }, {
83
- title: isPassage ? t('Confirm Passage Removal') : t('Confirm Stimulus Removal'),
84
- text: isPassage ? t('Are you sure you want to remove this passage?') : t('Are you sure you want to remove this stimulus?'),
85
- continueText: isPassage ? t('Remove Passage') : t('Remove Stimulus'),
86
- cancelText: isPassage ? t('Keep Passage ') : t('Keep Stimulus'),
87
- automationPrefix: isPassage ? 'passage' : 'stimulus'
83
+ title: isPassage ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal'),
84
+ text: isPassage ? t('Are you sure you want to remove this text block?') : t('Are you sure you want to remove this stimulus?'),
85
+ continueText: isPassage ? t('Remove Text Block') : t('Remove Stimulus'),
86
+ cancelText: isPassage ? t('Keep Text Block ') : t('Keep Stimulus'),
87
+ automationPrefix: isPassage ? 'text-block' : 'stimulus'
88
88
  });
89
89
  });
90
90
  _defineProperty(_this2, "handleDeleteStimulus", function () {
@@ -154,7 +154,7 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
154
154
  _context2.next = 9;
155
155
  break;
156
156
  }
157
- message = _this2.isPassage() ? t('Passage not saved due to validation errors with the data.') : t('Stimulus not saved due to validation errors with the data.');
157
+ message = _this2.isPassage() ? t('Text Block not saved due to validation errors with the data.') : t('Stimulus not saved due to validation errors with the data.');
158
158
  _context2.next = 5;
159
159
  return _this2.props.showError(_this2.props.guid);
160
160
  case 5:
@@ -316,7 +316,7 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
316
316
  }, {
317
317
  key: "afterSubmit",
318
318
  value: function afterSubmit() {
319
- var message = this.isPassage() ? t('Changes to passage saved.') : t('Changes to stimulus saved.');
319
+ var message = this.isPassage() ? t('Changes to text block saved.') : t('Changes to stimulus saved.');
320
320
  this.props.switchOffEditing();
321
321
  this.clearModifications();
322
322
  this.props.setUi(SHOULD_CLONE_ITEM, false);
@@ -366,8 +366,8 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
366
366
  }, {
367
367
  key: "renderStimulusEdit",
368
368
  value: function renderStimulusEdit() {
369
- var stimulusLabel = this.isPassage() ? t('Passage') : t('Stimulus');
370
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
369
+ var stimulusLabel = this.isPassage() ? t('Text Block') : t('Stimulus');
370
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
371
371
  return jsx("div", null, jsx("div", {
372
372
  css: this.props.styles.stimulus,
373
373
  ref: this.handleRef
@@ -423,9 +423,10 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
423
423
  var _this$props = this.props,
424
424
  stimulus = _this$props.stimulus,
425
425
  quizEntry = _this$props.quizEntry;
426
+ var isPassage = stimulus.isPassage;
426
427
  var needsWarning = stimulus.isImmutable() || quizEntry.isArchivedBankEntry;
427
428
  var propForWrapperFunc = quizEntry.isArchivedBankEntry ? propsForBankEntryVersioningWrapper : propsForStimulusVersioningWrapper;
428
- var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning');
429
+ var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning', isPassage);
429
430
  var hasWarningWrapper = needsWarning && !this.props.shouldClone;
430
431
  return jsx(WarningWrapper, propsForStimulusVersioning, hasWarningWrapper ? jsx(StimulusShowInfo, this.props) : this.renderStimulusEdit());
431
432
  }
@@ -72,9 +72,9 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
72
72
  key: "headerText",
73
73
  value: function headerText(stimulus) {
74
74
  if (stimulus.isTemporary()) {
75
- return stimulus.passage ? t('Add Passage') : t('Add Stimulus');
75
+ return stimulus.passage ? t('Add Text Block') : t('Add Stimulus');
76
76
  } else {
77
- return stimulus.passage ? t('Edit Passage') : t('Edit Stimulus');
77
+ return stimulus.passage ? t('Edit Text Block') : t('Edit Stimulus');
78
78
  }
79
79
  }
80
80
  }, {
@@ -118,7 +118,7 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
118
118
  }
119
119
  return jsx(Alert, {
120
120
  variant: "warning"
121
- }, t('The passage sections may not appear in their original order due to the shuffle setting.'));
121
+ }, t('The text block sections may not appear in their original order due to the shuffle setting.'));
122
122
  }
123
123
  }, {
124
124
  key: "renderInstructions",
@@ -163,8 +163,8 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
163
163
  var stimulus = this.props.workingStimulus;
164
164
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
165
165
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
166
- var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
167
- var message = stimulus.passage ? t('Edit Passage') : t('Edit Stimulus');
166
+ var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
167
+ var message = stimulus.passage ? t('Edit Text Block') : t('Edit Stimulus');
168
168
  return jsx(FormFieldGroup, {
169
169
  messages: this.inputErrors('onSelf'),
170
170
  description: jsx(ScreenReaderContent, null, message)
@@ -58,7 +58,7 @@ export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComp
58
58
  }, {
59
59
  key: "render",
60
60
  value: function render() {
61
- var stimulusLabel = this.props.stimulus.passage ? t('Passage') : t('Stimulus');
61
+ var stimulusLabel = this.props.stimulus.passage ? t('Text Block') : t('Stimulus');
62
62
  return jsx(Overlay, {
63
63
  onClick: this.switchOnEditing,
64
64
  wrapperStyles: this.props.styles.stimulusWrapper,
@@ -35,7 +35,7 @@ var StimulusShowInfo = /*#__PURE__*/function (_Component) {
35
35
  key: "render",
36
36
  value: function render() {
37
37
  var stimulus = this.props.stimulus;
38
- var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
38
+ var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
39
39
  var instructions = stimulus.instructions && /*#__PURE__*/React.createElement(View, {
40
40
  as: "div",
41
41
  padding: "small",
@@ -61,8 +61,8 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
61
61
  return _this2.props.addStimulus(true);
62
62
  };
63
63
  Icon = IconPlusLine;
64
- name = t('Passage');
65
- title = t('Add Passage');
64
+ name = t('Text Block');
65
+ title = t('Add Text Block');
66
66
  automation = 'sdk-interaction-button-passage';
67
67
  break;
68
68
  default:
@@ -179,6 +179,7 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
179
179
  styles: PropTypes.object
180
180
  }), _defineProperty(_InteractionTypes, "defaultProps", {
181
181
  allowStimulusCreation: true,
182
+ allowPassageCreation: false,
182
183
  types: List()
183
184
  }), _InteractionTypes)) || _class);
184
185
  export default InteractionTypes;
@@ -30,6 +30,13 @@ export var posObjFromQuizEntry = cachePreviousArgs(function (quizEntryDragging,
30
30
  // handle dragging items over stimulus
31
31
  if (!quizEntryDragging.hasStimulus && quizEntryHovered.hasStimulus && (onRightHalf || inSidebar)) {
32
32
  if (deepInsideEntry && quizEntryHovered.getNestedEntries().size === 0) {
33
+ if (quizEntryHovered.entryType === 'BankEntry') {
34
+ var bankEntry = quizEntryHovered.getEntry();
35
+ var bankEntryItem = bankEntry === null || bankEntry === void 0 ? void 0 : bankEntry.getEntry();
36
+ if (bankEntryItem !== null && bankEntryItem !== void 0 && bankEntryItem.isPassage) {
37
+ return null;
38
+ }
39
+ }
33
40
  if (quizEntryHovered.isPassage) {
34
41
  return null;
35
42
  }
@@ -67,7 +67,15 @@ export var BankEntry = /*#__PURE__*/function (_ReduxRecord) {
67
67
  }, {
68
68
  key: "isStimulus",
69
69
  get: function get() {
70
- return this.entryType === 'Stimulus';
70
+ var _this$getEntry;
71
+ return this.entryType === 'Stimulus' && !((_this$getEntry = this.getEntry()) !== null && _this$getEntry !== void 0 && _this$getEntry.isPassage);
72
+ }
73
+ }, {
74
+ key: "isPassage",
75
+ get: function get() {
76
+ var _this$getEntry2;
77
+ if (!this.isStimulus) return false;
78
+ return (_this$getEntry2 = this.getEntry()) === null || _this$getEntry2 === void 0 ? void 0 : _this$getEntry2.isPassage;
71
79
  }
72
80
  }]);
73
81
  }(ReduxRecord({
@@ -367,7 +367,7 @@ export var QuizEntry = (_dec = withStateCache(function () {
367
367
  var type;
368
368
  if (this.hasStimulus || this.isBank) {
369
369
  if (this.isPassage) {
370
- type = t('Passage');
370
+ type = t('Text Block');
371
371
  var opts = {
372
372
  type: type,
373
373
  start: displayPosition - 1
@@ -137,19 +137,28 @@ export default (function () {
137
137
  entryType: action.payload.bankEntryType
138
138
  };
139
139
  var stateWithBankEntryMods = updateObjectOfType(stateWithBankMods, TEMPORARY_BANK_ENTRY_ID, bankEntryMods, 'bankEntries');
140
- var bankItemMods = action.payload.bankEntryType === 'Item' ? {
141
- interactionData: action.payload.interactionTypeData.interactionData,
142
- interactionType: action.payload.interactionTypeData.id,
143
- itemBody: action.payload.interactionTypeData.itemBody,
144
- properties: action.payload.interactionTypeData.properties,
145
- scoringData: action.payload.interactionTypeData.scoringData,
146
- title: null
147
- } : {
148
- title: ''
149
- };
140
+ var bankItemMods;
141
+ if (action.payload.bankEntryType === 'Item') {
142
+ bankItemMods = {
143
+ interactionData: action.payload.interactionTypeData.interactionData,
144
+ interactionType: action.payload.interactionTypeData.id,
145
+ itemBody: action.payload.interactionTypeData.itemBody,
146
+ properties: action.payload.interactionTypeData.properties,
147
+ scoringData: action.payload.interactionTypeData.scoringData,
148
+ title: null
149
+ };
150
+ } else {
151
+ var isPassage = action.payload.interactionTypeData.passage;
152
+ bankItemMods = isPassage ? {
153
+ title: '',
154
+ passage: true,
155
+ orientation: 'top'
156
+ } : {
157
+ title: ''
158
+ };
159
+ }
150
160
  var collection = action.payload.bankEntryType === 'Item' ? 'items' : 'stimuli';
151
- var stateWithMods = updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
152
- return stateWithMods;
161
+ return updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
153
162
  }();
154
163
  case CLEAR_NEXT_QUIZ_ENTRY:
155
164
  return state["delete"]('nextQuizEntry');
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
1
2
  import React from 'react';
2
3
  import partial from 'lodash/partial';
3
4
  import { Text } from '@instructure/ui-text';
@@ -45,11 +46,20 @@ export var propsForStimulusVersioningWrapper = function propsForStimulusVersioni
45
46
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
46
47
  args[_key2] = arguments[_key2];
47
48
  }
49
+ var isPassage = args[args.length - 1];
50
+ var restArgs = args.slice(0, -1);
51
+ var itemName = isPassage ? 'text block' : 'stimulus';
52
+ var title = t('Some students have already submitted answers for this {itemName}!', {
53
+ itemName: itemName
54
+ });
55
+ var content = t('You can apply your edits to a copy of this {itemName}' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.', {
56
+ itemName: itemName
57
+ });
48
58
  return propsForVersioningWrapper.apply(void 0, [/*#__PURE__*/React.createElement(Text, {
49
59
  color: "primary"
50
60
  }, /*#__PURE__*/React.createElement("b", null, t('Editing a copy.')), "\xA0", t('Statistics from this new copy will appear separate from the previous version.')), /*#__PURE__*/React.createElement(Text, {
51
61
  color: "primary"
52
- }, /*#__PURE__*/React.createElement("b", null, t('Some students have already submitted answers for this stimulus!')), "\xA0", t('You can apply your edits to a copy of this stimulus' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.'))].concat(args));
62
+ }, /*#__PURE__*/React.createElement("b", null, title), "\xA0", content)].concat(_toConsumableArray(restArgs)));
53
63
  };
54
64
  export var propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
55
65
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -84,8 +94,8 @@ export var propsForItemBankEntryEditPrompt = function propsForItemBankEntryEditP
84
94
  };
85
95
  export var propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
86
96
  var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
87
- var title = isPassage ? t('Banked Passage.') : t('Banked Stimulus.');
88
- var content = isPassage ? t('Editing of this passage must take place within the bank.') : t('Editing of this stimulus must take place within the bank.');
97
+ var title = isPassage ? t('Banked Text Block.') : t('Banked Stimulus.');
98
+ var content = isPassage ? t('Editing of this text block must take place within the bank.') : t('Editing of this stimulus must take place within the bank.');
89
99
  var promptComponent = /*#__PURE__*/React.createElement(View, {
90
100
  as: "div",
91
101
  "data-automation": "sdk-editInBanks-warning"