@instructure/canvas-rce 5.10.0 → 5.11.1

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 (55) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/Dockerfile +1 -1
  3. package/es/common/mimeClass.js +70 -67
  4. package/es/enhance-user-content/doc_previews.js +1 -1
  5. package/es/enhance-user-content/enhance_user_content.js +9 -1
  6. package/es/getThemeVars.js +3 -4
  7. package/es/rce/RCE.js +1 -3
  8. package/es/rce/RCEWrapper.js +3 -67
  9. package/es/rce/RceHtmlEditor.js +28 -8
  10. package/es/rce/plugins/instructure_links/components/Link.js +3 -9
  11. package/es/rce/plugins/instructure_links/components/LinkSet.js +4 -8
  12. package/es/rce/plugins/instructure_links/components/NoResults.js +5 -10
  13. package/es/rce/plugins/instructure_links/plugin.js +1 -7
  14. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
  15. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
  16. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
  17. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
  18. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
  19. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
  20. package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
  21. package/es/rce/plugins/shared/CanvasContentTray.js +7 -1
  22. package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
  23. package/es/rce/plugins/tinymce-a11y-checker/components/{color-field.js → ColorField.js} +9 -7
  24. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
  25. package/es/rce/root.js +1 -3
  26. package/es/rce/transformContent.js +8 -0
  27. package/es/sidebar/actions/upload.js +3 -1
  28. package/jest/jest-setup.js +2 -0
  29. package/lib/common/mimeClass.js +70 -67
  30. package/lib/enhance-user-content/doc_previews.js +1 -1
  31. package/lib/enhance-user-content/enhance_user_content.js +9 -1
  32. package/lib/getThemeVars.js +3 -4
  33. package/lib/rce/RCE.js +1 -3
  34. package/lib/rce/RCEWrapper.js +3 -67
  35. package/lib/rce/RceHtmlEditor.js +28 -8
  36. package/lib/rce/plugins/instructure_links/components/Link.js +3 -9
  37. package/lib/rce/plugins/instructure_links/components/LinkSet.js +4 -8
  38. package/lib/rce/plugins/instructure_links/components/NoResults.js +5 -10
  39. package/lib/rce/plugins/instructure_links/plugin.js +1 -7
  40. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
  41. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
  42. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
  43. package/lib/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
  44. package/lib/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
  45. package/lib/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
  46. package/lib/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
  47. package/lib/rce/plugins/shared/CanvasContentTray.js +7 -1
  48. package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
  49. package/lib/rce/plugins/tinymce-a11y-checker/components/{color-field.js → ColorField.js} +9 -7
  50. package/lib/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
  51. package/lib/rce/root.js +1 -3
  52. package/lib/rce/transformContent.js +8 -0
  53. package/lib/sidebar/actions/upload.js +3 -1
  54. package/locales/en.json +1438 -89
  55. package/package.json +52 -51
@@ -1,3 +1,5 @@
1
+ import _pt from "prop-types";
2
+
1
3
  /*
2
4
  * Copyright (C) 2019 - present Instructure, Inc.
3
5
  *
@@ -16,14 +18,12 @@
16
18
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
19
  */
18
20
  import React from 'react';
19
- import PropTypes from 'prop-types';
20
21
  import { Tray } from '@instructure/ui-tray';
21
22
  import { View } from '@instructure/ui-view';
22
23
  import { Flex } from '@instructure/ui-flex';
23
24
  import { Heading } from '@instructure/ui-heading';
24
25
  import { CloseButton } from '@instructure/ui-buttons';
25
26
  import formatMessage from 'format-message';
26
- const FlexItem = Flex.Item;
27
27
  export function ExternalToolDialogTray(props) {
28
28
  const {
29
29
  label,
@@ -56,9 +56,9 @@ export function ExternalToolDialogTray(props) {
56
56
  }, /*#__PURE__*/React.createElement(Flex, {
57
57
  as: "div",
58
58
  padding: "small"
59
- }, /*#__PURE__*/React.createElement(FlexItem, {
59
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
60
60
  shouldGrow: true
61
- }, /*#__PURE__*/React.createElement(Heading, null, name)), /*#__PURE__*/React.createElement(FlexItem, null, /*#__PURE__*/React.createElement(CloseButton, {
61
+ }, /*#__PURE__*/React.createElement(Heading, null, name)), /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(CloseButton, {
62
62
  onClick: onCloseButton,
63
63
  size: "small",
64
64
  screenReaderLabel: formatMessage('Close')
@@ -74,12 +74,6 @@ export function ExternalToolDialogTray(props) {
74
74
  }, children)))));
75
75
  }
76
76
  ExternalToolDialogTray.propTypes = {
77
- open: PropTypes.bool,
78
- label: PropTypes.string.isRequired,
79
- mountNode: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
80
- onOpen: PropTypes.func,
81
- onClose: PropTypes.func,
82
- onCloseButton: PropTypes.func,
83
- name: PropTypes.string.isRequired,
84
- children: PropTypes.node
77
+ onCloseButton: _pt.func,
78
+ name: _pt.string.isRequired
85
79
  };
@@ -70,7 +70,7 @@ export function ExternalToolSelectionDialog(props) {
70
70
  "data-mce-component": true,
71
71
  liveRegion: getLiveRegion,
72
72
  size: "medium",
73
- theme: {
73
+ themeOverride: {
74
74
  mediumMaxWidth: '42rem'
75
75
  },
76
76
  label: formatMessage('Apps'),
@@ -79,7 +79,7 @@ export function ExternalToolSelectionDialog(props) {
79
79
  open: true,
80
80
  shouldCloseOnDocumentClick: false
81
81
  }, /*#__PURE__*/React.createElement(Modal.Header, {
82
- theme: {
82
+ themeOverride: {
83
83
  padding: '0.5rem'
84
84
  }
85
85
  }, /*#__PURE__*/React.createElement(CloseButton, {
@@ -35,7 +35,7 @@ export default class ResourceLinkContentItem extends BaseLinkContentItem {
35
35
 
36
36
  buildUrl() {
37
37
  return addQueryParamsToUrl(this.context.ltiEndpoint, {
38
- display: 'borderless',
38
+ display: 'in_rce',
39
39
  resource_link_lookup_uuid: this.lookup_uuid,
40
40
  [PARENT_FRAME_CONTEXT_PARAM]: this.context.containingCanvasLtiToolId
41
41
  });
@@ -146,7 +146,7 @@ export default class TrayController {
146
146
  // If not, we can't update the MediaObject in the canvas db.
147
147
 
148
148
 
149
- if (videoOptions.media_object_id && videoOptions.media_object_id !== 'undefined' && !videoOptions.isLocked) {
149
+ if (videoOptions.media_object_id && videoOptions.media_object_id !== 'undefined') {
150
150
  videoOptions.updateMediaObject(data).then(_r => {
151
151
  if (this.$videoContainer && videoOptions.displayAs === 'embed') {
152
152
  this.$videoContainer.contentWindow.postMessage({
@@ -181,10 +181,15 @@ export default class TrayController {
181
181
  let vo = {};
182
182
 
183
183
  if (this._shouldOpen) {
184
+ /*
185
+ * When the tray is being opened again, it should be rendered fresh
186
+ * (clearing the internal state) so that the currently-selected video can
187
+ * be used for initial video options.
188
+ */
184
189
  this._renderId++;
190
+ vo = asVideoElement(this.$videoContainer) || {};
185
191
  }
186
192
 
187
- vo = asVideoElement(this.$videoContainer) || {};
188
193
  const element = /*#__PURE__*/React.createElement(VideoOptionsTray, {
189
194
  id: "video-options-tray",
190
195
  key: this._renderId,
@@ -38,13 +38,10 @@ import DimensionsInput, { useDimensionsState } from '../../shared/DimensionsInpu
38
38
  import { getTrayHeight } from '../../shared/trayUtils';
39
39
  import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers';
40
40
  import { parsedStudioOptionsPropType } from '../../shared/StudioLtiSupportUtils';
41
- import RCEGlobals from '../../../RCEGlobals';
42
41
 
43
42
  const getLiveRegion = () => document.getElementById('flash_screenreader_holder');
44
43
 
45
44
  export default function VideoOptionsTray(_ref) {
46
- var _RCEGlobals$getConfig;
47
-
48
45
  let {
49
46
  videoOptions,
50
47
  onRequestClose,
@@ -71,9 +68,7 @@ export default function VideoOptionsTray(_ref) {
71
68
  const [minWidth] = useState(MIN_WIDTH_VIDEO);
72
69
  const [minHeight] = useState(Math.round(videoHeight / videoWidth * MIN_WIDTH_VIDEO));
73
70
  const [minPercentage] = useState(MIN_PERCENTAGE);
74
- const lock_statuses = (_RCEGlobals$getConfig = RCEGlobals.getConfig()) === null || _RCEGlobals$getConfig === void 0 ? void 0 : _RCEGlobals$getConfig.lockedAttachments;
75
71
  const isStudio = !!studioOptions;
76
- const isLocked = !!lock_statuses && !!lock_statuses[videoOptions.attachmentId];
77
72
  const showDisplayOptions = !isStudio || studioOptions.convertibleToLink;
78
73
  const showSizeControls = !isStudio || studioOptions.resizable;
79
74
  const dimensionsState = useDimensionsState(videoOptions, {
@@ -129,8 +124,7 @@ export default function VideoOptionsTray(_ref) {
129
124
  appliedWidth,
130
125
  displayAs,
131
126
  subtitles,
132
- updateMediaObject,
133
- isLocked
127
+ updateMediaObject
134
128
  });
135
129
  }
136
130
 
@@ -213,7 +207,7 @@ export default function VideoOptionsTray(_ref) {
213
207
  shouldShrink: true
214
208
  }, /*#__PURE__*/React.createElement(Flex, {
215
209
  direction: "column"
216
- }, !isLocked && /*#__PURE__*/React.createElement(Flex.Item, {
210
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
217
211
  padding: "small"
218
212
  }, isStudio ? /*#__PURE__*/React.createElement(Flex, {
219
213
  direction: "column"
@@ -272,7 +266,7 @@ export default function VideoOptionsTray(_ref) {
272
266
  minWidth: minWidth,
273
267
  minPercentage: minPercentage,
274
268
  hidePercentage: true
275
- }))), !isStudio && !isLocked && /*#__PURE__*/React.createElement(Flex.Item, {
269
+ }))), !isStudio && /*#__PURE__*/React.createElement(Flex.Item, {
276
270
  padding: "small"
277
271
  }, /*#__PURE__*/React.createElement(FormFieldGroup, {
278
272
  description: formatMessage('Closed Captions/Subtitles')
@@ -24,41 +24,33 @@ import { BaseButton, CloseButton } from '@instructure/ui-buttons';
24
24
  import { Heading } from '@instructure/ui-heading';
25
25
  import { Table } from '@instructure/ui-table';
26
26
  import formatMessage from '../../../../format-message';
27
- import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers'; // Doing this to avoid TS2339 errors -- TODO: remove once we're on InstUI 8
28
-
29
- const {
30
- Head,
31
- Row,
32
- ColHeader,
33
- Body,
34
- Cell
35
- } = Table;
27
+ import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers';
36
28
 
37
29
  const renderBody = (headers, rows) => {
38
30
  return /*#__PURE__*/React.createElement(Table, {
39
31
  caption: formatMessage('Word Count')
40
- }, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement(Row, null, headers.map(_ref => {
32
+ }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, headers.map(_ref => {
41
33
  let {
42
34
  id,
43
35
  getLabel
44
36
  } = _ref;
45
- return /*#__PURE__*/React.createElement(ColHeader, {
37
+ return /*#__PURE__*/React.createElement(Table.ColHeader, {
46
38
  key: id,
47
39
  id: id
48
40
  }, getLabel());
49
- }))), /*#__PURE__*/React.createElement(Body, null, rows.map(_ref2 => {
41
+ }))), /*#__PURE__*/React.createElement(Table.Body, null, rows.map(_ref2 => {
50
42
  let {
51
43
  label,
52
44
  documentCount,
53
45
  selectionCount
54
46
  } = _ref2;
55
- return /*#__PURE__*/React.createElement(Row, {
47
+ return /*#__PURE__*/React.createElement(Table.Row, {
56
48
  key: label
57
- }, /*#__PURE__*/React.createElement(Cell, {
49
+ }, /*#__PURE__*/React.createElement(Table.Cell, {
58
50
  key: "label"
59
- }, label), /*#__PURE__*/React.createElement(Cell, {
51
+ }, label), /*#__PURE__*/React.createElement(Table.Cell, {
60
52
  key: "document"
61
- }, documentCount), /*#__PURE__*/React.createElement(Cell, {
53
+ }, documentCount), /*#__PURE__*/React.createElement(Table.Cell, {
62
54
  key: "selection"
63
55
  }, selectionCount));
64
56
  })));
@@ -241,6 +241,7 @@ export default function CanvasContentTray(props) {
241
241
  const [hidingTrayOnAction, setHidingTrayOnAction] = useState(true);
242
242
  const trayRef = useRef(null);
243
243
  const scrollingAreaRef = useRef(null);
244
+ const closeButtonRef = useRef(null);
244
245
  const [filterSettings, setFilterSettings] = useFilterSettings();
245
246
  const [isEditTray, setIsEditTray] = useState(false);
246
247
  const [link, setLink] = useState(null);
@@ -267,6 +268,8 @@ export default function CanvasContentTray(props) {
267
268
  useEffect(() => {
268
269
  const controller = {
269
270
  showTrayForPlugin(plugin) {
271
+ var _closeButtonRef$curre;
272
+
270
273
  // increment a counter that's used as the key when rendering
271
274
  // this gets us a new instance everytime, which is necessary
272
275
  // to get the queries run so we have up to date data.
@@ -294,6 +297,8 @@ export default function CanvasContentTray(props) {
294
297
  } else {
295
298
  setIsEditTray(false);
296
299
  }
300
+
301
+ (_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 ? void 0 : _closeButtonRef$curre.focus();
297
302
  },
298
303
 
299
304
  hideTray(forceClose) {
@@ -474,7 +479,8 @@ export default function CanvasContentTray(props) {
474
479
  offset: "medium",
475
480
  onClick: handleDismissTray,
476
481
  "data-testid": "CloseButton_ContentTray",
477
- screenReaderLabel: formatMessage('Close')
482
+ screenReaderLabel: formatMessage('Close'),
483
+ elementRef: el => closeButtonRef.current = el
478
484
  })), isEditTray && /*#__PURE__*/React.createElement(LinkDisplay, {
479
485
  linkText: linkText,
480
486
  placeholderText: (link === null || link === void 0 ? void 0 : link.title) || placeholderText,
@@ -15,7 +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 { parse } from 'url';
18
+ import { format, parse } from 'url';
19
19
  import { absoluteToRelativeUrl } from '../../../common/fileUrl';
20
20
  import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
21
21
  import RCEGlobals from '../../RCEGlobals';
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
94
94
  const type = content_type.replace(/\/.*$/, '');
95
95
 
96
96
  if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
97
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
97
+ const url = parse(`/media_attachments_iframe/${file.id}`, true);
98
+ url.query.type = type;
99
+ url.query.embedded = true;
100
+
101
+ if (file.uuid && file.contextType == 'User') {
102
+ url.query.verifier = file.uuid;
103
+ } else if (file.url || file.href) {
104
+ const parsed_url = parse(file.url || file.href, true);
105
+
106
+ if (parsed_url.query.verifier) {
107
+ url.query.verifier = parsed_url.query.verifier;
108
+ }
99
109
  }
100
110
 
101
- const parsed_url = parse(file.url || file.href, true);
102
- const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
103
- return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
111
+ return format(url);
104
112
  }
105
113
 
106
114
  if (file.embedded_iframe_url) {
@@ -1,3 +1,5 @@
1
+ import _pt from "prop-types";
2
+
1
3
  /*
2
4
  * Copyright (C) 2018 - present Instructure, Inc.
3
5
  *
@@ -15,8 +17,8 @@
15
17
  * You should have received a copy of the GNU Affero General Public License along
16
18
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
19
  */
18
- import React from 'react';
19
- import PropTypes from 'prop-types';
20
+ import React from 'react'; // @ts-expect-error
21
+
20
22
  import contrast from 'wcag-element-contrast';
21
23
  import { TextInput } from '@instructure/ui-text-input';
22
24
  import { View } from '@instructure/ui-view';
@@ -62,7 +64,7 @@ export default class ColorField extends React.Component {
62
64
  as: "div"
63
65
  }, /*#__PURE__*/React.createElement(TextInput, {
64
66
  "data-testid": "color-field-text-input",
65
- label: this.props.label,
67
+ renderLabel: this.props.label,
66
68
  value: this.state.textValue,
67
69
  onChange: e => this.setState({
68
70
  textValue: e.target.value
@@ -77,8 +79,8 @@ export default class ColorField extends React.Component {
77
79
 
78
80
  }
79
81
  ColorField.propTypes = {
80
- label: PropTypes.string.isRequired,
81
- name: PropTypes.string.isRequired,
82
- value: PropTypes.string.isRequired,
83
- onChange: PropTypes.func.isRequired
82
+ label: _pt.string.isRequired,
83
+ name: _pt.string.isRequired,
84
+ value: _pt.string.isRequired,
85
+ onChange: _pt.func.isRequired
84
86
  };
@@ -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,
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');
@@ -118,4 +118,6 @@ if (typeof window.URL.createObjectURL === 'undefined') {
118
118
  Object.defineProperty(window.URL, 'createObjectURL', {value: () => 'http://example.com/whatever'})
119
119
  }
120
120
 
121
+ global.DataTransferItem = global.DataTransferItem || class DataTransferItem {}
122
+
121
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
  }