@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.
- package/.mocharc.js +7 -0
- package/CHANGELOG.md +47 -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/enhance-user-content/mathml.js +8 -5
- package/es/getThemeVars.js +3 -4
- package/es/rce/RCE.js +1 -3
- package/es/rce/RCEWrapper.js +3 -48
- package/es/rce/RceHtmlEditor.js +20 -38
- package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
- 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/ExternalToolDialogModal.js +4 -5
- 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 +15 -9
- package/es/rce/plugins/shared/ContentSelection.js +7 -3
- package/es/rce/plugins/shared/ImageCropper/Preview.js +8 -7
- package/es/rce/plugins/shared/LinkDisplay.js +2 -2
- package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/{lib/rce/plugins/tinymce-a11y-checker/components/color-field.js → es/rce/plugins/tinymce-a11y-checker/components/ColorField.js} +9 -7
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
- package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
- package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
- package/es/rce/root.js +1 -3
- package/es/rce/transformContent.js +8 -0
- package/es/sidebar/actions/upload.js +3 -1
- package/es/translations/locales/de.js +4 -4
- package/jest/jest-setup.js +2 -1
- 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/enhance-user-content/mathml.js +8 -5
- package/lib/getThemeVars.js +3 -4
- package/lib/rce/RCE.js +1 -3
- package/lib/rce/RCEWrapper.js +3 -48
- package/lib/rce/RceHtmlEditor.js +20 -38
- package/lib/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
- 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/ExternalToolDialogModal.js +4 -5
- 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 +15 -9
- package/lib/rce/plugins/shared/ContentSelection.js +7 -3
- package/lib/rce/plugins/shared/ImageCropper/Preview.js +8 -7
- package/lib/rce/plugins/shared/LinkDisplay.js +2 -2
- package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/{es/rce/plugins/tinymce-a11y-checker/components/color-field.js → lib/rce/plugins/tinymce-a11y-checker/components/ColorField.js} +9 -7
- package/lib/rce/plugins/tinymce-a11y-checker/components/checker.js +27 -24
- package/lib/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
- package/lib/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
- package/lib/rce/root.js +1 -3
- package/lib/rce/transformContent.js +8 -0
- package/lib/sidebar/actions/upload.js +3 -1
- package/lib/translations/locales/de.js +4 -4
- package/locales/en.json +1438 -89
- package/package.json +58 -55
- package/canvas/README.md +0 -84
- package/canvas/locales/en.json +0 -934
- package/canvas/package.json +0 -189
- package/es/rce/getBrowser.js +0 -53
- package/lib/rce/getBrowser.js +0 -53
|
@@ -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
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -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/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');
|
|
@@ -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": "
|
|
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": "
|
|
2281
|
+
"message": "Meine Dokumente"
|
|
2282
2282
|
},
|
|
2283
2283
|
"user_files_78e21703": {
|
|
2284
2284
|
"message": "Benutzerdateien"
|
|
2285
2285
|
},
|
|
2286
2286
|
"user_images_b6490852": {
|
|
2287
|
-
"message": "
|
|
2287
|
+
"message": "Meine Bilder"
|
|
2288
2288
|
},
|
|
2289
2289
|
"user_media_14fbf656": {
|
|
2290
|
-
"message": "
|
|
2290
|
+
"message": "Meine Medien"
|
|
2291
2291
|
},
|
|
2292
2292
|
"vector_notation_cf6086ab": {
|
|
2293
2293
|
"message": "Vektor (Notation)"
|