@instructure/canvas-rce 5.10.0 → 5.10.2
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 +11 -0
- package/es/enhance-user-content/enhance_user_content.js +9 -1
- package/es/rce/RCEWrapper.js +987 -82
- package/es/rce/StatusBar.js +4 -6
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
- package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +4 -6
- package/es/rce/transformContent.js +8 -0
- package/es/sidebar/actions/upload.js +3 -1
- package/es/skins/theme.js +127 -0
- package/lib/enhance-user-content/enhance_user_content.js +9 -1
- package/lib/rce/RCEWrapper.js +987 -82
- package/lib/rce/StatusBar.js +4 -6
- package/lib/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/ResourceLinkContentItem.js +1 -1
- package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/rce/plugins/tinymce-a11y-checker/components/checker.js +4 -6
- package/lib/rce/transformContent.js +8 -0
- package/lib/sidebar/actions/upload.js +3 -1
- package/lib/skins/theme.js +127 -0
- package/package.json +9 -10
- package/canvas/README.md +0 -84
- package/canvas/locales/en.json +0 -934
- package/canvas/package.json +0 -189
- package/es/getThemeVars.js +0 -46
- package/es/rce/style.js +0 -843
- package/lib/getThemeVars.js +0 -46
- package/lib/rce/style.js +0 -843
package/es/rce/StatusBar.js
CHANGED
|
@@ -24,7 +24,7 @@ import { Button, IconButton, CondensedButton } from '@instructure/ui-buttons';
|
|
|
24
24
|
import { Flex } from '@instructure/ui-flex';
|
|
25
25
|
import { View } from '@instructure/ui-view';
|
|
26
26
|
import { Badge } from '@instructure/ui-badge';
|
|
27
|
-
import {
|
|
27
|
+
import { ApplyTheme } from '@instructure/ui-themeable';
|
|
28
28
|
import { Text } from '@instructure/ui-text';
|
|
29
29
|
import { SVGIcon } from '@instructure/ui-svg-images';
|
|
30
30
|
import { IconA11yLine, IconKeyboardShortcutsLine, IconMiniArrowEndLine, IconFullScreenLine, IconExitFullScreenLine } from '@instructure/ui-icons';
|
|
@@ -190,12 +190,10 @@ export default function StatusBar(props) {
|
|
|
190
190
|
return button;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
return /*#__PURE__*/React.createElement(
|
|
193
|
+
return /*#__PURE__*/React.createElement(ApplyTheme, {
|
|
194
194
|
theme: {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
colorPrimary: props.a11yBadgeColor
|
|
198
|
-
}
|
|
195
|
+
[Badge.theme]: {
|
|
196
|
+
colorPrimary: props.a11yBadgeColor
|
|
199
197
|
}
|
|
200
198
|
}
|
|
201
199
|
}, /*#__PURE__*/React.createElement(Badge, {
|
|
@@ -35,7 +35,7 @@ export default class ResourceLinkContentItem extends BaseLinkContentItem {
|
|
|
35
35
|
|
|
36
36
|
buildUrl() {
|
|
37
37
|
return addQueryParamsToUrl(this.context.ltiEndpoint, {
|
|
38
|
-
display: '
|
|
38
|
+
display: 'in_rce',
|
|
39
39
|
resource_link_lookup_uuid: this.lookup_uuid,
|
|
40
40
|
[PARENT_FRAME_CONTEXT_PARAM]: this.context.containingCanvasLtiToolId
|
|
41
41
|
});
|
|
@@ -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) {
|
|
@@ -36,7 +36,7 @@ import { TextInput } from '@instructure/ui-text-input';
|
|
|
36
36
|
import { TextArea } from '@instructure/ui-text-area';
|
|
37
37
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
38
38
|
import { IconQuestionLine } from '@instructure/ui-icons';
|
|
39
|
-
import {
|
|
39
|
+
import { ApplyTheme } from '@instructure/ui-themeable';
|
|
40
40
|
import { Alert } from '@instructure/ui-alerts';
|
|
41
41
|
import ColorField from './color-field';
|
|
42
42
|
import PlaceholderSVG from './placeholder-svg';
|
|
@@ -428,12 +428,10 @@ export default class Checker extends React.Component {
|
|
|
428
428
|
onClick: () => this.setState({
|
|
429
429
|
showWhyPopover: false
|
|
430
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(
|
|
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(ApplyTheme, {
|
|
432
432
|
theme: {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
textDecoration: 'underline'
|
|
436
|
-
}
|
|
433
|
+
[Link.theme]: {
|
|
434
|
+
textDecoration: 'underline'
|
|
437
435
|
}
|
|
438
436
|
}
|
|
439
437
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
@@ -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');
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - present Instructure, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Canvas.
|
|
5
|
+
*
|
|
6
|
+
* Canvas is free software: you can redistribute it and/or modify it under
|
|
7
|
+
* the terms of the GNU Affero General Public License as published by the Free
|
|
8
|
+
* Software Foundation, version 3 of the License.
|
|
9
|
+
*
|
|
10
|
+
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
12
|
+
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
13
|
+
* details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along
|
|
16
|
+
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { darken, lighten, alpha } from '@instructure/ui-color-utils'; // pull canvas theme values we need for the rce skin
|
|
19
|
+
|
|
20
|
+
export default function generator(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
borders,
|
|
23
|
+
colors,
|
|
24
|
+
forms,
|
|
25
|
+
shadows,
|
|
26
|
+
spacing,
|
|
27
|
+
typography
|
|
28
|
+
} = _ref;
|
|
29
|
+
const vars = {
|
|
30
|
+
canvasBackgroundColor: colors.white,
|
|
31
|
+
canvasTextColor: colors.textDarkest,
|
|
32
|
+
canvasErrorColor: colors.textDanger,
|
|
33
|
+
canvasWarningColor: colors.textWarning,
|
|
34
|
+
canvasInfoColor: colors.textInfo,
|
|
35
|
+
canvasSuccessColor: colors.textSuccess,
|
|
36
|
+
canvasBorderColor: colors.borderMedium,
|
|
37
|
+
toolbarButtonHoverBackground: darken(colors.backgroundLightest, 5),
|
|
38
|
+
// copied from INSTUI "light" Button
|
|
39
|
+
canvasBrandColor: colors.brand,
|
|
40
|
+
activeMenuItemBackground: colors.backgroundBrand,
|
|
41
|
+
activeMenuItemLabelColor: colors.textLightest,
|
|
42
|
+
tableSelectorHighlightColor: alpha(lighten(colors.brand, 10), 50),
|
|
43
|
+
canvasLinkColor: colors.link,
|
|
44
|
+
canvasLinkDecoration: 'none',
|
|
45
|
+
// the instui default button
|
|
46
|
+
canvasButtonBackground: colors.backgroundLightest,
|
|
47
|
+
canvasButtonBorderColor: 'transparent',
|
|
48
|
+
canvasButtonColor: colors.textDarkest,
|
|
49
|
+
canvasButtonHoverBackground: colors.backgroundLightest,
|
|
50
|
+
canvasButtonHoverColor: colors.brand,
|
|
51
|
+
canvasButtonActiveBackground: colors.backgroundLightest,
|
|
52
|
+
canvasButtonFontWeight: typography.fontWeightNormal,
|
|
53
|
+
canvasButtonFontSize: typography.fontSizeMedium,
|
|
54
|
+
canvasButtonLineHeight: forms.inputHeightMedium,
|
|
55
|
+
canvasButtonPadding: `0 ${spacing.small}`,
|
|
56
|
+
// the instui primary button
|
|
57
|
+
canvasPrimaryButtonBackground: colors.backgroundBrand,
|
|
58
|
+
canvasPrimaryButtonColor: colors.textLightest,
|
|
59
|
+
canvasPrimaryButtonBorderColor: 'transparent',
|
|
60
|
+
canvasPrimaryButtonHoverBackground: darken(colors.backgroundBrand, 10),
|
|
61
|
+
canvasPrimaryButtonHoverColor: colors.textLightest,
|
|
62
|
+
// the instui secondary button
|
|
63
|
+
canvasSecondaryButtonBackground: colors.backgroundLight,
|
|
64
|
+
canvasSecondaryButtonColor: colors.textDarkest,
|
|
65
|
+
canvasSecondaryButtonBorderColor: darken(colors.backgroundLight, 10),
|
|
66
|
+
canvasSecondaryButtonHoverBackground: darken(colors.backgroundLight, 10),
|
|
67
|
+
canvasSecondaryButtonHoverColor: colors.textDarkest,
|
|
68
|
+
canvasFocusBorderColor: borders.brand,
|
|
69
|
+
canvasFocusBorderWidth: borders.widthSmall,
|
|
70
|
+
// canvas really uses widthMedium
|
|
71
|
+
canvasFocusBoxShadow: `0 0 0 2px ${colors.brand}`,
|
|
72
|
+
canvasEnabledColor: borders.brand,
|
|
73
|
+
canvasEnabledBoxShadow: `inset 0 0 0.1875rem 0.0625rem ${darken(colors.borderLightest, 25)}`,
|
|
74
|
+
canvasFontFamily: typography.fontFamily,
|
|
75
|
+
canvasFontSize: '1rem',
|
|
76
|
+
canvasFontSizeSmall: typography.fontSizeSmall,
|
|
77
|
+
// modal dialogs
|
|
78
|
+
canvasModalShadow: shadows.depth3,
|
|
79
|
+
canvasModalHeadingPadding: spacing.medium,
|
|
80
|
+
canvasModalHeadingFontSize: typography.fontSizeXLarge,
|
|
81
|
+
canvasModalHeadingFontWeight: typography.fontWeightNormal,
|
|
82
|
+
canvasModalBodyPadding: spacing.medium,
|
|
83
|
+
canvasModalFooterPadding: spacing.small,
|
|
84
|
+
canvasModalFooterBackground: colors.backgroundLight,
|
|
85
|
+
canvasFormElementMargin: `0 0 ${spacing.medium} 0`,
|
|
86
|
+
canvasFormElementLabelColor: colors.textDarkest,
|
|
87
|
+
canvasFormElementLabelMargin: `0 0 ${spacing.small} 0`,
|
|
88
|
+
canvasFormElementLabelFontSize: typography.fontSizeMedium,
|
|
89
|
+
canvasFormElementLabelFontWeight: typography.fontWeightBold,
|
|
90
|
+
// a11y button badge
|
|
91
|
+
canvasBadgeBackgroundColor: colors.textInfo
|
|
92
|
+
};
|
|
93
|
+
vars.tinySplitButtonChevronHoverBackground = darken(vars.toolbarButtonHoverBackground, 10);
|
|
94
|
+
return vars;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
generator.canvas = function (variables) {
|
|
98
|
+
return {
|
|
99
|
+
canvasLinkColor: variables['ic-link-color'],
|
|
100
|
+
canvasLinkDecoration: variables['ic-link-decoration'],
|
|
101
|
+
canvasTextColor: variables['ic-brand-font-color-dark'],
|
|
102
|
+
canvasBrandColor: variables['ic-brand-primary'],
|
|
103
|
+
canvasFocusBorderColor: variables['ic-brand-primary'],
|
|
104
|
+
canvasFocusBoxShadow: `0 0 0 2px ${variables['ic-brand-primary']}`,
|
|
105
|
+
canvasEnabledColor: variables['ic-brand-primary'],
|
|
106
|
+
canvasPrimaryButtonBackground: variables['ic-brand-primary'],
|
|
107
|
+
canvasPrimaryButtonColor: variables['ic-brand-button--primary-text'],
|
|
108
|
+
canvasPrimaryButtonHoverBackground: darken(variables['ic-brand-button--primary-bgd'], 10),
|
|
109
|
+
activeMenuItemBackground: variables['ic-brand-button--primary-bgd'],
|
|
110
|
+
activeMenuItemLabelColor: variables['ic-brand-button--primary-text'],
|
|
111
|
+
tableSelectorHighlightColor: alpha(lighten(variables['ic-brand-primary'], 10), 50)
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
generator['canvas-a11y'] = generator['canvas-high-contrast'] = function (_ref2) {
|
|
116
|
+
let {
|
|
117
|
+
colors
|
|
118
|
+
} = _ref2;
|
|
119
|
+
return {
|
|
120
|
+
canvasButtonBackground: colors.backgroundLight,
|
|
121
|
+
canvasSecondaryButtonBorderColor: colors.borderMedium,
|
|
122
|
+
canvasLinkDecoration: 'underline',
|
|
123
|
+
canvasFocusBorderColor: colors.borderBrand,
|
|
124
|
+
canvasFocusBoxShadow: `0 0 0 2px ${colors.brand}`,
|
|
125
|
+
canvasBrandColor: colors.brand
|
|
126
|
+
};
|
|
127
|
+
};
|
|
@@ -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;
|