@instructure/canvas-rce 5.9.0 → 5.11.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 (79) hide show
  1. package/.mocharc.js +7 -0
  2. package/CHANGELOG.md +47 -0
  3. package/Dockerfile +1 -1
  4. package/es/common/mimeClass.js +70 -67
  5. package/es/enhance-user-content/doc_previews.js +1 -1
  6. package/es/enhance-user-content/enhance_user_content.js +9 -1
  7. package/es/enhance-user-content/mathml.js +8 -5
  8. package/es/getThemeVars.js +3 -4
  9. package/es/rce/RCE.js +1 -3
  10. package/es/rce/RCEWrapper.js +3 -48
  11. package/es/rce/RceHtmlEditor.js +20 -38
  12. package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
  13. package/es/rce/plugins/instructure_links/components/Link.js +3 -9
  14. package/es/rce/plugins/instructure_links/components/LinkSet.js +4 -8
  15. package/es/rce/plugins/instructure_links/components/NoResults.js +5 -10
  16. package/es/rce/plugins/instructure_links/plugin.js +1 -7
  17. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
  18. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +4 -5
  19. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
  20. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
  21. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
  22. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
  23. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
  24. package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
  25. package/es/rce/plugins/shared/CanvasContentTray.js +15 -9
  26. package/es/rce/plugins/shared/ContentSelection.js +7 -3
  27. package/es/rce/plugins/shared/ImageCropper/Preview.js +8 -7
  28. package/es/rce/plugins/shared/LinkDisplay.js +2 -2
  29. package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
  30. package/{lib/rce/plugins/tinymce-a11y-checker/components/color-field.js → es/rce/plugins/tinymce-a11y-checker/components/ColorField.js} +9 -7
  31. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
  32. package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
  33. package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
  34. package/es/rce/root.js +1 -3
  35. package/es/rce/transformContent.js +8 -0
  36. package/es/sidebar/actions/upload.js +3 -1
  37. package/es/translations/locales/de.js +4 -4
  38. package/jest/jest-setup.js +2 -1
  39. package/lib/common/mimeClass.js +70 -67
  40. package/lib/enhance-user-content/doc_previews.js +1 -1
  41. package/lib/enhance-user-content/enhance_user_content.js +9 -1
  42. package/lib/enhance-user-content/mathml.js +8 -5
  43. package/lib/getThemeVars.js +3 -4
  44. package/lib/rce/RCE.js +1 -3
  45. package/lib/rce/RCEWrapper.js +3 -48
  46. package/lib/rce/RceHtmlEditor.js +20 -38
  47. package/lib/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
  48. package/lib/rce/plugins/instructure_links/components/Link.js +3 -9
  49. package/lib/rce/plugins/instructure_links/components/LinkSet.js +4 -8
  50. package/lib/rce/plugins/instructure_links/components/NoResults.js +5 -10
  51. package/lib/rce/plugins/instructure_links/plugin.js +1 -7
  52. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
  53. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +4 -5
  54. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
  55. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
  56. package/lib/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
  57. package/lib/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
  58. package/lib/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
  59. package/lib/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
  60. package/lib/rce/plugins/shared/CanvasContentTray.js +15 -9
  61. package/lib/rce/plugins/shared/ContentSelection.js +7 -3
  62. package/lib/rce/plugins/shared/ImageCropper/Preview.js +8 -7
  63. package/lib/rce/plugins/shared/LinkDisplay.js +2 -2
  64. package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
  65. package/{es/rce/plugins/tinymce-a11y-checker/components/color-field.js → lib/rce/plugins/tinymce-a11y-checker/components/ColorField.js} +9 -7
  66. package/lib/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
  67. package/lib/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
  68. package/lib/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
  69. package/lib/rce/root.js +1 -3
  70. package/lib/rce/transformContent.js +8 -0
  71. package/lib/sidebar/actions/upload.js +3 -1
  72. package/lib/translations/locales/de.js +4 -4
  73. package/locales/en.json +1438 -89
  74. package/package.json +58 -55
  75. package/canvas/README.md +0 -84
  76. package/canvas/locales/en.json +0 -934
  77. package/canvas/package.json +0 -189
  78. package/es/rce/getBrowser.js +0 -53
  79. package/lib/rce/getBrowser.js +0 -53
@@ -20,8 +20,7 @@
20
20
  // our own imported describe function confuses eslint
21
21
  import React from 'react';
22
22
  import { LiveAnnouncer, LiveMessage } from 'react-aria-live';
23
- import { ScreenReaderContent } from '@instructure/ui-a11y-content';
24
- import { Button, CloseButton } from '@instructure/ui-buttons';
23
+ import { Button, CloseButton, IconButton } from '@instructure/ui-buttons';
25
24
  import { Flex } from '@instructure/ui-flex';
26
25
  import { Tray } from '@instructure/ui-tray';
27
26
  import { Popover } from '@instructure/ui-popover';
@@ -38,7 +37,7 @@ import { SimpleSelect } from '@instructure/ui-simple-select';
38
37
  import { IconQuestionLine } from '@instructure/ui-icons';
39
38
  import { InstUISettingsProvider } from '@instructure/emotion';
40
39
  import { Alert } from '@instructure/ui-alerts';
41
- import ColorField from './color-field';
40
+ import ColorField from './ColorField';
42
41
  import PlaceholderSVG from './placeholder-svg';
43
42
  import describe from '../utils/describe';
44
43
  import * as dom from '../utils/dom';
@@ -363,7 +362,7 @@ export default class Checker extends React.Component {
363
362
  placement: "end",
364
363
  contentRef: e => this.trayElement = e,
365
364
  size: "regular",
366
- theme: {
365
+ themeOverride: {
367
366
  regularWidth: '22em'
368
367
  }
369
368
  }, /*#__PURE__*/React.createElement(Flex, {
@@ -380,10 +379,11 @@ export default class Checker extends React.Component {
380
379
  }, /*#__PURE__*/React.createElement(Heading, {
381
380
  as: "h2"
382
381
  }, formatMessage('Accessibility Checker'))), /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(CloseButton, {
382
+ screenReaderLabel: formatMessage('Close Accessibility Checker'),
383
383
  placement: "end",
384
384
  onClick: () => this.handleClose(),
385
- buttonRef: ref => this._closeButtonRef = ref
386
- }, formatMessage('Close Accessibility Checker'))))), /*#__PURE__*/React.createElement(Flex.Item, {
385
+ elementRef: ref => this._closeButtonRef = ref
386
+ })))), /*#__PURE__*/React.createElement(Flex.Item, {
387
387
  as: "div",
388
388
  padding: "0 large large"
389
389
  }, this.state.errors.length > 0 && /*#__PURE__*/React.createElement(View, {
@@ -408,30 +408,33 @@ export default class Checker extends React.Component {
408
408
  width: "auto"
409
409
  }, /*#__PURE__*/React.createElement(Popover, {
410
410
  on: "click",
411
- show: this.state.showWhyPopover,
411
+ isShowingContent: this.state.showWhyPopover,
412
412
  shouldContainFocus: true,
413
- shouldReturnFocus: true
414
- }, /*#__PURE__*/React.createElement(Popover.Trigger, null, /*#__PURE__*/React.createElement(Button, {
415
- variant: "icon",
416
- icon: IconQuestionLine,
417
- onClick: () => this.setState({
418
- showWhyPopover: true
419
- })
420
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, formatMessage('Why')))), /*#__PURE__*/React.createElement(Popover.Content, null, /*#__PURE__*/React.createElement(View, {
413
+ shouldReturnFocus: true,
414
+ renderTrigger: () => /*#__PURE__*/React.createElement(IconButton, {
415
+ screenReaderLabel: formatMessage('Why'),
416
+ renderIcon: IconQuestionLine,
417
+ onClick: () => this.setState({
418
+ showWhyPopover: true
419
+ }),
420
+ withBackground: false,
421
+ withBorder: false
422
+ }, /*#__PURE__*/React.createElement(IconQuestionLine, null))
423
+ }, /*#__PURE__*/React.createElement(View, {
421
424
  padding: "medium",
422
425
  display: "block",
423
426
  width: "16rem"
424
427
  }, /*#__PURE__*/React.createElement(CloseButton, {
425
428
  placement: "end",
426
429
  offset: "x-small",
427
- variant: "icon",
428
430
  onClick: () => this.setState({
429
431
  showWhyPopover: false
430
- })
431
- }, formatMessage('Close')), /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement("p", null, rule.why()), /*#__PURE__*/React.createElement("p", null, rule.link && rule.link.length && /*#__PURE__*/React.createElement(InstUISettingsProvider, {
432
- theme: {
432
+ }),
433
+ screenReaderLabel: formatMessage('Close')
434
+ }), /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement("p", null, rule.why()), /*#__PURE__*/React.createElement("p", null, rule.link && rule.link.length && /*#__PURE__*/React.createElement(InstUISettingsProvider, {
435
+ themeOverride: {
433
436
  componentOverrides: {
434
- Link: {
437
+ [Link.componentId]: {
435
438
  textDecoration: 'underline'
436
439
  }
437
440
  }
@@ -439,7 +442,7 @@ export default class Checker extends React.Component {
439
442
  }, /*#__PURE__*/React.createElement(Link, {
440
443
  href: rule.link,
441
444
  target: "_blank"
442
- }, rule.linkText()))))))))))), /*#__PURE__*/React.createElement("form", {
445
+ }, rule.linkText())))))))))), /*#__PURE__*/React.createElement("form", {
443
446
  onSubmit: event => {
444
447
  event.preventDefault();
445
448
  this.fixIssue();
@@ -469,13 +472,13 @@ export default class Checker extends React.Component {
469
472
  width: "auto"
470
473
  }, /*#__PURE__*/React.createElement(Button, {
471
474
  type: "submit",
472
- variant: "primary",
475
+ color: "primary",
473
476
  disabled: !this.state.formStateValid
474
477
  }, formatMessage('Apply')))))))), this.state.errors.length === 0 && !this.state.checking && /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement("p", null, formatMessage('No accessibility issues were detected.'))), /*#__PURE__*/React.createElement(PlaceholderSVG, null)), this.state.checking && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LiveMessage, {
475
478
  message: formatMessage('Checking for accessibility issues'),
476
479
  "aria-live": "polite"
477
480
  }), /*#__PURE__*/React.createElement(Spinner, {
478
- title: formatMessage('Checking for accessibility issues'),
481
+ renderTitle: formatMessage('Checking for accessibility issues'),
479
482
  margin: "medium auto"
480
483
  }))))));
481
484
  }
@@ -539,7 +542,7 @@ export default class Checker extends React.Component {
539
542
 
540
543
  default:
541
544
  return /*#__PURE__*/React.createElement(TextInput, {
542
- label: f.label,
545
+ renderLabel: f.label,
543
546
  name: f.dataKey,
544
547
  value: this.state.formState[f.dataKey] || '',
545
548
  onChange: this.updateFormState,
@@ -30,6 +30,15 @@ export default {
30
30
  return true;
31
31
  }
32
32
 
33
+ for (let e = elem; e; e = e.parentElement) {
34
+ const bgimage = window.getComputedStyle(e).getPropertyValue('background-image');
35
+
36
+ if (bgimage !== 'none' && bgimage !== '') {
37
+ // ignore background images and gradients
38
+ return true;
39
+ }
40
+ }
41
+
33
42
  return contrast(elem);
34
43
  },
35
44
  data: smallTextContrast.data,
@@ -32,6 +32,15 @@ export default {
32
32
  return true;
33
33
  }
34
34
 
35
+ for (let e = elem; e; e = e.parentElement) {
36
+ const bgimage = window.getComputedStyle(e).getPropertyValue('background-image');
37
+
38
+ if (bgimage !== 'none' && bgimage !== '') {
39
+ // ignore background images and gradients
40
+ return true;
41
+ }
42
+ }
43
+
35
44
  return contrast(elem);
36
45
  },
37
46
  data: elem => {
package/es/rce/root.js CHANGED
@@ -1,5 +1,3 @@
1
- var _process, _process$env;
2
-
3
1
  /*
4
2
  * Copyright (C) 2018 - present Instructure, Inc.
5
3
  *
@@ -23,7 +21,7 @@ import RCEWrapper from './RCEWrapper';
23
21
  import normalizeProps from './normalizeProps';
24
22
  import formatMessage from '../format-message';
25
23
 
26
- if (!((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env.BUILD_LOCALE)) {
24
+ if (!process || !process.env || !undefined) {
27
25
  formatMessage.setup({
28
26
  locale: 'en',
29
27
  generateId: require('format-message-generate-id/underscored_crc32'),
@@ -60,6 +60,14 @@ export function transformRceContentForEditing(inputHtml, options) {
60
60
  for (const attributeName of attributeNamesToRemove) {
61
61
  element.removeAttribute(attributeName);
62
62
  }
63
+ }); // fixup LTI iframe launches to use the `in_rce` display type
64
+
65
+ container.querySelectorAll('iframe[src]').forEach(element => {
66
+ const src = element.getAttribute('src');
67
+
68
+ if (src !== null && src !== void 0 && src.includes('display=borderless')) {
69
+ element.setAttribute('src', src.replace('display=borderless', 'display=in_rce'));
70
+ }
63
71
  });
64
72
  return container.innerHTML;
65
73
  }
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
272
272
  media_id: mediaObject.media_object.media_id,
273
273
  type: uploadedFile.type,
274
274
  title: uploadedFile.title || uploadedFile.name,
275
- id: mediaObject.media_object.attachment_id
275
+ id: mediaObject.media_object.attachment_id,
276
+ uuid: mediaObject.media_object.uuid,
277
+ contextType: mediaObject.media_object.context_type
276
278
  };
277
279
  dispatch(removePlaceholdersFor(uploadedFile.name));
278
280
  embedUploadResult(embedData, 'media');
@@ -373,7 +373,7 @@ const locale = {
373
373
  "message": "{ count, plural,\n one {# Objekt geladen}\n other {# Objekte geladen}\n}"
374
374
  },
375
375
  "course_documents_104d76e0": {
376
- "message": "Kursunterlagen"
376
+ "message": "Kursdokumente"
377
377
  },
378
378
  "course_files_62deb8f8": {
379
379
  "message": "Kursdateien"
@@ -2278,16 +2278,16 @@ const locale = {
2278
2278
  "message": "Wird von Screenreadern verwendet, um das Video zu beschreiben."
2279
2279
  },
2280
2280
  "user_documents_c206e61f": {
2281
- "message": "Benutzer*in Dokumente"
2281
+ "message": "Meine Dokumente"
2282
2282
  },
2283
2283
  "user_files_78e21703": {
2284
2284
  "message": "Benutzerdateien"
2285
2285
  },
2286
2286
  "user_images_b6490852": {
2287
- "message": "Benutzerbilder"
2287
+ "message": "Meine Bilder"
2288
2288
  },
2289
2289
  "user_media_14fbf656": {
2290
- "message": "Nutzer-Medien"
2290
+ "message": "Meine Medien"
2291
2291
  },
2292
2292
  "vector_notation_cf6086ab": {
2293
2293
  "message": "Vektor (Notation)"
@@ -41,7 +41,6 @@ const ignoredErrors = [
41
41
  /The prop `videoOptions.naturalHeight` is marked as required in `VideoOptionsTray`/,
42
42
  /The prop `sortBy.order` is marked as required in `MediaPanel`/,
43
43
  /Invalid prop `images.searchString` of type `string` supplied to `Images`/,
44
- /Invalid URL: undefined/,
45
44
  /failed updating video captions/,
46
45
  /You seem to have overlapping act\(\) calls/,
47
46
  /A theme registry has already been initialized/,
@@ -119,4 +118,6 @@ if (typeof window.URL.createObjectURL === 'undefined') {
119
118
  Object.defineProperty(window.URL, 'createObjectURL', {value: () => 'http://example.com/whatever'})
120
119
  }
121
120
 
121
+ global.DataTransferItem = global.DataTransferItem || class DataTransferItem {}
122
+
122
123
  window.scroll = () => {}
@@ -42,75 +42,78 @@ export function mimeClass(file) {
42
42
  } else {
43
43
  const contentType = getContentType(file); // NOTE: Keep this list in sync with what's in canvas-lms/app/models/attachment.rb
44
44
 
45
- return {
46
- 'text/html': 'html',
47
- 'text/x-csharp': 'code',
48
- 'text/xml': 'code',
49
- 'text/css': 'code',
50
- text: 'text',
51
- 'text/plain': 'text',
52
- 'application/rtf': 'doc',
53
- 'text/rtf': 'doc',
54
- 'application/vnd.oasis.opendocument.text': 'doc',
55
- 'application/pdf': 'pdf',
56
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'doc',
57
- 'application/vnd.apple.pages': 'doc',
58
- 'application/x-docx': 'doc',
59
- 'application/msword': 'doc',
60
- 'application/vnd.ms-powerpoint': 'ppt',
61
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'ppt',
62
- 'applicatoin/vnd.apple.key': 'ppt',
63
- 'application/vnd.ms-excel': 'xls',
64
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xls',
65
- 'application/vnd.apple.numbers': 'xls',
66
- 'application/vnd.oasis.opendocument.spreadsheet': 'xls',
67
- 'image/jpeg': 'image',
68
- 'image/pjpeg': 'image',
69
- 'image/png': 'image',
70
- 'image/gif': 'image',
71
- 'image/bmp': 'image',
72
- 'image/svg+xml': 'image',
73
- 'image/webp': 'image',
74
- 'application/x-rar': 'zip',
75
- 'application/x-rar-compressed': 'zip',
76
- 'application/x-zip': 'zip',
77
- 'application/x-zip-compressed': 'zip',
78
- 'application/xml': 'code',
79
- 'application/zip': 'zip',
80
- 'audio/mp3': 'audio',
81
- 'audio/mpeg': 'audio',
82
- 'audio/basic': 'audio',
83
- 'audio/mid': 'audio',
84
- 'audio/3gpp': 'audio',
85
- 'audio/x-aiff': 'audio',
86
- 'audio/x-m4a': 'audio',
87
- 'audio/x-mpegurl': 'audio',
88
- 'audio/x-ms-wma': 'audio',
89
- 'audio/x-pn-realaudio': 'audio',
90
- 'audio/x-wav': 'audio',
91
- 'audio/mp4': 'audio',
92
- 'audio/wav': 'audio',
93
- 'audio/webm': 'audio',
94
- 'audio/*': 'audio',
95
- audio: 'audio',
96
- 'video/mpeg': 'video',
97
- 'video/quicktime': 'video',
98
- 'video/x-la-asf': 'video',
99
- 'video/x-ms-asf': 'video',
100
- 'video/x-ms-wma': 'audio',
101
- 'video/x-ms-wmv': 'video',
102
- 'video/x-msvideo': 'video',
103
- 'video/x-sgi-movie': 'video',
104
- 'video/3gpp': 'video',
105
- 'video/mp4': 'video',
106
- 'video/webm': 'video',
107
- 'video/avi': 'video',
108
- 'video/*': 'video',
109
- video: 'video',
110
- 'application/x-shockwave-flash': 'flash'
111
- }[contentType] || file.mime_class || 'file';
45
+ return contentMapping(contentType) || file.mime_class || 'file';
112
46
  }
113
47
  }
48
+ export function contentMapping(contentType) {
49
+ return {
50
+ 'text/html': 'html',
51
+ 'text/x-csharp': 'code',
52
+ 'text/xml': 'code',
53
+ 'text/css': 'code',
54
+ text: 'text',
55
+ 'text/plain': 'text',
56
+ 'application/rtf': 'doc',
57
+ 'text/rtf': 'doc',
58
+ 'application/vnd.oasis.opendocument.text': 'doc',
59
+ 'application/pdf': 'pdf',
60
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'doc',
61
+ 'application/vnd.apple.pages': 'doc',
62
+ 'application/x-docx': 'doc',
63
+ 'application/msword': 'doc',
64
+ 'application/vnd.ms-powerpoint': 'ppt',
65
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'ppt',
66
+ 'applicatoin/vnd.apple.key': 'ppt',
67
+ 'application/vnd.ms-excel': 'xls',
68
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xls',
69
+ 'application/vnd.apple.numbers': 'xls',
70
+ 'application/vnd.oasis.opendocument.spreadsheet': 'xls',
71
+ 'image/jpeg': 'image',
72
+ 'image/pjpeg': 'image',
73
+ 'image/png': 'image',
74
+ 'image/gif': 'image',
75
+ 'image/bmp': 'image',
76
+ 'image/svg+xml': 'image',
77
+ 'image/webp': 'image',
78
+ 'application/x-rar': 'zip',
79
+ 'application/x-rar-compressed': 'zip',
80
+ 'application/x-zip': 'zip',
81
+ 'application/x-zip-compressed': 'zip',
82
+ 'application/xml': 'code',
83
+ 'application/zip': 'zip',
84
+ 'audio/mp3': 'audio',
85
+ 'audio/mpeg': 'audio',
86
+ 'audio/basic': 'audio',
87
+ 'audio/mid': 'audio',
88
+ 'audio/3gpp': 'audio',
89
+ 'audio/x-aiff': 'audio',
90
+ 'audio/x-m4a': 'audio',
91
+ 'audio/x-mpegurl': 'audio',
92
+ 'audio/x-ms-wma': 'audio',
93
+ 'audio/x-pn-realaudio': 'audio',
94
+ 'audio/x-wav': 'audio',
95
+ 'audio/mp4': 'audio',
96
+ 'audio/wav': 'audio',
97
+ 'audio/webm': 'audio',
98
+ 'audio/*': 'audio',
99
+ audio: 'audio',
100
+ 'video/mpeg': 'video',
101
+ 'video/quicktime': 'video',
102
+ 'video/x-la-asf': 'video',
103
+ 'video/x-ms-asf': 'video',
104
+ 'video/x-ms-wma': 'audio',
105
+ 'video/x-ms-wmv': 'video',
106
+ 'video/x-msvideo': 'video',
107
+ 'video/x-sgi-movie': 'video',
108
+ 'video/3gpp': 'video',
109
+ 'video/mp4': 'video',
110
+ 'video/webm': 'video',
111
+ 'video/avi': 'video',
112
+ 'video/*': 'video',
113
+ video: 'video',
114
+ 'application/x-shockwave-flash': 'flash'
115
+ }[contentType];
116
+ }
114
117
 
115
118
  function getContentType(file) {
116
119
  return file['content-type'] || file.content_type || file.type;
@@ -65,7 +65,7 @@ export function showLoadingImage($link) {
65
65
 
66
66
  ReactDOM.render( /*#__PURE__*/React.createElement(Spinner, {
67
67
  size: "x-small",
68
- title: formatMessage('Loading')
68
+ renderTitle: formatMessage('Loading')
69
69
  }), $imageHolder);
70
70
  return $link;
71
71
  }
@@ -216,8 +216,16 @@ export function enhanceUserContent() {
216
216
  iframeElem.setAttribute('src', addParentFrameContextToUrl(src, containingCanvasLtiToolId));
217
217
  }
218
218
  });
219
- }
219
+ } // tell LTI tools that they are launching from within the active RCE
220
+
221
+
222
+ unenhanced_elem.querySelectorAll('iframe[src]').forEach(iframeElem => {
223
+ const src = iframeElem.getAttribute('src');
220
224
 
225
+ if (src.startsWith(canvasOrigin)) {
226
+ iframeElem.setAttribute('src', src.replace('display=in_rce', 'display=borderless'));
227
+ }
228
+ });
221
229
  unenhanced_elem.querySelectorAll('a:not(.not_external, .external)').forEach(childLink => {
222
230
  if (!isExternalLink(childLink, canvasOrigin)) return;
223
231
  if (childLink.tagName === 'IMG' || childLink.querySelectorAll('img').length > 0) return;
@@ -45,7 +45,8 @@ const localConfig = {
45
45
  }
46
46
  }
47
47
  },
48
- showMathMenu: true
48
+ showMathMenu: true,
49
+ messageStyle: 'none'
49
50
  };
50
51
 
51
52
  class Mathml {
@@ -106,7 +107,7 @@ class Mathml {
106
107
  window.MathJax.Hub.Register.MessageHook('Math Processing Error', function (message) {
107
108
  var _elem$parentElement;
108
109
 
109
- const elem = message[1]; // ".math_equation_latex" is the elem we added for MathJax to typeset the image equation
110
+ const elem = Array.isArray(message[1]) ? message[1][0] : message[1]; // ".math_equation_latex" is the elem we added for MathJax to typeset the image equation
110
111
 
111
112
  if ((_elem$parentElement = elem.parentElement) !== null && _elem$parentElement !== void 0 && _elem$parentElement.classList.contains('math_equation_latex')) {
112
113
  var _elem$parentElement$p;
@@ -123,7 +124,7 @@ class Mathml {
123
124
  }
124
125
  });
125
126
  window.MathJax.Hub.Register.MessageHook('End Math', function (message) {
126
- const elem = message[1];
127
+ const elem = Array.isArray(message[1]) ? message[1][0] : message[1];
127
128
  mathImageHelper.removeStrayEquationImages(elem);
128
129
  mathImageHelper.nearlyInfiniteStyleFix(elem);
129
130
  elem.querySelectorAll('.math_equation_latex').forEach(m => m.classList.add('fade-in-equation'));
@@ -138,7 +139,8 @@ class Mathml {
138
139
  // Since we want to ignore <math> in .hidden-readable spans, let's remove the MathJunk™
139
140
  // right after MathJax adds it.
140
141
  window.MathJax.Hub.Register.MessageHook('End Math', function (message) {
141
- $(message[1]).find('.hidden-readable [class^="MathJax"], .hidden-readable [id^="MathJax"]').remove();
142
+ const elm = Array.isArray(message[1]) ? message[1][0] : message[1];
143
+ $(elm).find('.hidden-readable [class^="MathJax"], .hidden-readable [id^="MathJax"]').remove();
142
144
  });
143
145
  } // leaving this here so I don't have to keep looking up how to see all messages
144
146
  // window.MathJax.Hub.Startup.signal.Interest(function (message) {
@@ -315,7 +317,8 @@ const mathImageHelper = {
315
317
  },
316
318
 
317
319
  catchEquationImages(refnode) {
318
- // find equation images and replace with inline LaTeX
320
+ refnode = Array.isArray(refnode) ? refnode[0] : refnode; // find equation images and replace with inline LaTeX
321
+
319
322
  const eqimgs = refnode.querySelectorAll('img.equation_image');
320
323
 
321
324
  if (eqimgs.length > 0) {
@@ -15,8 +15,7 @@
15
15
  * You should have received a copy of the GNU Affero General Public License along
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { ThemeRegistry } from '@instructure/ui-themeable'; // ^^ at InstUI 8, just directly import getRegistry directly from @instructure/theme-registry
19
-
18
+ import { getRegistry } from '@instructure/theme-registry';
20
19
  import { merge, cloneDeep } from 'lodash'; // The running theme is the running theme for this page load, and it never
21
20
  // changes, so there's no point in doing the work more than once.
22
21
 
@@ -28,13 +27,13 @@ function getThemeVars() {
28
27
  defaultThemeKey,
29
28
  overrides,
30
29
  themes
31
- } = ThemeRegistry.getRegistry(); // Just assume the "canvas" theme if the default key is null. This will
30
+ } = getRegistry(); // Just assume the "canvas" theme if the default key is null. This will
32
31
  // never happen in the live app because one way or another a theme gets
33
32
  // used, but unit tests don't always do that.
34
33
  // Also we have to cloneDeep this because the merge below is about to
35
34
  // mutate the whole thing.
36
35
 
37
- const variables = cloneDeep(themes[defaultThemeKey !== null && defaultThemeKey !== void 0 ? defaultThemeKey : 'canvas'].variables);
36
+ const variables = cloneDeep(themes[defaultThemeKey !== null && defaultThemeKey !== void 0 ? defaultThemeKey : 'canvas']);
38
37
  merge(variables, overrides);
39
38
  memoizedVariables = {
40
39
  variables,
package/lib/rce/RCE.js CHANGED
@@ -1,5 +1,3 @@
1
- var _process, _process$env;
2
-
3
1
  // @ts-nocheck
4
2
 
5
3
  /*
@@ -29,7 +27,7 @@ import tinyRCE from './tinyRCE';
29
27
  import getTranslations from '../getTranslations';
30
28
  import '@instructure/canvas-theme';
31
29
 
32
- if (!((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env.BUILD_LOCALE)) {
30
+ if (!process || !process.env || !undefined) {
33
31
  formatMessage.setup({
34
32
  locale: 'en',
35
33
  generateId: require('format-message-generate-id/underscored_crc32'),
@@ -2714,48 +2714,9 @@ class RCEWrapper extends React.Component {
2714
2714
 
2715
2715
  this.checkAccessibility();
2716
2716
  this.fixToolbarKeyboardNavigation();
2717
- this.forwardPostMessages();
2718
2717
  (_this$props$onInitted = (_this$props = this.props).onInitted) === null || _this$props$onInitted === void 0 ? void 0 : _this$props$onInitted.call(_this$props, editor);
2719
2718
  };
2720
2719
 
2721
- this.forwardPostMessages = () => {
2722
- const windowReferences = {};
2723
- const rceWindow = this.editor.getWin(); // explicitly assign name for reference by parent window
2724
-
2725
- rceWindow.name = `${RCEWrapper.editorFrameName}_${this.id}`;
2726
- rceWindow.addEventListener('message', this.forwardPostMessagesHandler(rceWindow, windowReferences));
2727
- };
2728
-
2729
- this.forwardPostMessagesHandler = (rceWindow, windowReferences) => e => {
2730
- let message;
2731
-
2732
- try {
2733
- message = typeof e.data === 'string' ? JSON.parse(e.data) : e.data;
2734
- } catch (err) {
2735
- // unparseable message may not be meant for our handlers
2736
- return false;
2737
- }
2738
-
2739
- if (e.origin === rceWindow.origin) {
2740
- // message is from Canvas window, forward to tool
2741
- const targetOrigin = message.toolOrigin;
2742
-
2743
- if (!targetOrigin) {
2744
- return false;
2745
- }
2746
-
2747
- const targetWindow = windowReferences[targetOrigin];
2748
- delete message.toolOrigin;
2749
- targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.postMessage(message, targetOrigin);
2750
- } else {
2751
- // message is from tool, forward to Canvas window
2752
- windowReferences[e.origin] = e.source;
2753
- message.toolOrigin = e.origin;
2754
- message.frameName = rceWindow.name;
2755
- rceWindow.parent.postMessage(message, rceWindow.origin);
2756
- }
2757
- };
2758
-
2759
2720
  this.fixToolbarKeyboardNavigation = () => {
2760
2721
  var _this$_elementRef$cur2;
2761
2722
 
@@ -3181,19 +3142,15 @@ class RCEWrapper extends React.Component {
3181
3142
  getRequiredFeatureStatuses() {
3182
3143
  const {
3183
3144
  new_math_equation_handling = false,
3184
- rce_ux_improvements = false,
3185
3145
  explicit_latex_typesetting = false,
3186
3146
  rce_transform_loaded_content = false,
3187
- media_links_use_attachment_id = false,
3188
- improved_no_results_messaging = false
3147
+ media_links_use_attachment_id = false
3189
3148
  } = this.props.features;
3190
3149
  return {
3191
3150
  new_math_equation_handling,
3192
- rce_ux_improvements,
3193
3151
  explicit_latex_typesetting,
3194
3152
  rce_transform_loaded_content,
3195
- media_links_use_attachment_id,
3196
- improved_no_results_messaging
3153
+ media_links_use_attachment_id
3197
3154
  };
3198
3155
  }
3199
3156
 
@@ -3201,8 +3158,7 @@ class RCEWrapper extends React.Component {
3201
3158
  return {
3202
3159
  locale: normalizeLocale(this.props.language),
3203
3160
  flashAlertTimeout: this.props.flashAlertTimeout,
3204
- timezone: this.props.timezone,
3205
- lockedAttachments: this.props.lockedAttachments
3161
+ timezone: this.props.timezone
3206
3162
  };
3207
3163
  }
3208
3164
 
@@ -4238,7 +4194,6 @@ RCEWrapper.defaultProps = {
4238
4194
  canvasOrigin: ''
4239
4195
  };
4240
4196
  RCEWrapper.skinCssInjected = false;
4241
- RCEWrapper.editorFrameName = 'active_rce_frame';
4242
4197
 
4243
4198
  function mergeMenuItems(standard, custom) {
4244
4199
  var _custom$trim;