@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.
- package/CHANGELOG.md +42 -0
- package/Dockerfile +1 -1
- package/es/common/mimeClass.js +70 -67
- package/es/enhance-user-content/doc_previews.js +1 -1
- package/es/enhance-user-content/enhance_user_content.js +9 -1
- package/es/getThemeVars.js +3 -4
- package/es/rce/RCE.js +1 -3
- package/es/rce/RCEWrapper.js +3 -67
- package/es/rce/RceHtmlEditor.js +28 -8
- package/es/rce/plugins/instructure_links/components/Link.js +3 -9
- package/es/rce/plugins/instructure_links/components/LinkSet.js +4 -8
- package/es/rce/plugins/instructure_links/components/NoResults.js +5 -10
- package/es/rce/plugins/instructure_links/plugin.js +1 -7
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
- package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
- package/es/rce/plugins/shared/CanvasContentTray.js +7 -1
- package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/es/rce/plugins/tinymce-a11y-checker/components/{color-field.js → ColorField.js} +9 -7
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
- package/es/rce/root.js +1 -3
- package/es/rce/transformContent.js +8 -0
- package/es/sidebar/actions/upload.js +3 -1
- package/jest/jest-setup.js +2 -0
- package/lib/common/mimeClass.js +70 -67
- package/lib/enhance-user-content/doc_previews.js +1 -1
- package/lib/enhance-user-content/enhance_user_content.js +9 -1
- package/lib/getThemeVars.js +3 -4
- package/lib/rce/RCE.js +1 -3
- package/lib/rce/RCEWrapper.js +3 -67
- package/lib/rce/RceHtmlEditor.js +28 -8
- package/lib/rce/plugins/instructure_links/components/Link.js +3 -9
- package/lib/rce/plugins/instructure_links/components/LinkSet.js +4 -8
- package/lib/rce/plugins/instructure_links/components/NoResults.js +5 -10
- package/lib/rce/plugins/instructure_links/plugin.js +1 -7
- package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +1 -2
- package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogTray.js +6 -12
- package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +2 -2
- package/lib/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
- package/lib/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +7 -2
- package/lib/rce/plugins/instructure_record/VideoOptionsTray/index.js +3 -9
- package/lib/rce/plugins/instructure_wordcount/components/WordCountModal.js +8 -16
- package/lib/rce/plugins/shared/CanvasContentTray.js +7 -1
- package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/rce/plugins/tinymce-a11y-checker/components/{color-field.js → ColorField.js} +9 -7
- package/lib/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
- package/lib/rce/root.js +1 -3
- package/lib/rce/transformContent.js +8 -0
- package/lib/sidebar/actions/upload.js +3 -1
- package/locales/en.json +1438 -89
- package/package.json +52 -51
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
81
|
-
name:
|
|
82
|
-
value:
|
|
83
|
-
onChange:
|
|
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 {
|
|
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 './
|
|
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
|
-
|
|
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
|
-
|
|
386
|
-
}
|
|
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
|
-
|
|
411
|
+
isShowingContent: this.state.showWhyPopover,
|
|
412
412
|
shouldContainFocus: true,
|
|
413
|
-
shouldReturnFocus: true
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
-
|
|
432
|
-
|
|
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()))))))))))
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
545
|
+
renderLabel: f.label,
|
|
543
546
|
name: f.dataKey,
|
|
544
547
|
value: this.state.formState[f.dataKey] || '',
|
|
545
548
|
onChange: this.updateFormState,
|
package/lib/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 (!
|
|
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');
|