@instructure/canvas-rce 6.0.0 → 7.2.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/CHANGELOG.md +46 -0
- package/__tests__/common/indicate.test.js +5 -6
- package/es/bridge/Bridge.js +2 -4
- package/es/canvasFileBrowser/FileBrowser.js +2 -4
- package/es/common/browser.js +2 -2
- package/es/common/fileUrl.js +13 -3
- package/es/defaultTinymceConfig.d.ts +1 -1
- package/es/defaultTinymceConfig.js +149 -114
- package/es/enhance-user-content/enhance_user_content.js +7 -1
- package/es/enhance-user-content/instructure_helper.js +4 -0
- package/es/enhance-user-content/youtube_overlay.d.ts +1 -0
- package/es/enhance-user-content/youtube_overlay.js +87 -0
- package/es/format-message.d.js +1 -0
- package/es/format-message.js +5 -0
- package/es/index.d.ts +1 -1
- package/es/rce/RCE.d.ts +0 -1
- package/es/rce/RCE.js +5 -10
- package/es/rce/RCEGlobals.d.ts +0 -2
- package/es/rce/RCEGlobals.js +0 -1
- package/es/rce/RCEVariants.d.ts +8 -3
- package/es/rce/RCEVariants.js +36 -10
- package/es/rce/RCEWrapper.d.ts +3 -5
- package/es/rce/RCEWrapper.js +68 -83
- package/es/rce/RCEWrapperProps.d.ts +1 -1
- package/es/rce/ShowOnFocusButton/index.js +4 -2
- package/es/rce/StatusBar.js +61 -15
- package/es/rce/alertHandler.js +6 -7
- package/es/rce/plugins/instructure-ui-icons/plugin.js +2 -2
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.d.ts +1 -1
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +6 -10
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.d.ts +5 -15
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +4 -10
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.d.ts +7 -0
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +49 -9
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.d.ts +1 -8
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +13 -33
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.d.ts +1 -2
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +2 -1
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +1 -2
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +2 -4
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +10 -7
- package/es/rce/plugins/shared/ContentSelection.js +4 -7
- package/es/rce/plugins/shared/DimensionsInput/index.js +3 -3
- package/es/rce/plugins/shared/FixedContentTray.d.ts +7 -23
- package/es/rce/plugins/shared/FixedContentTray.js +7 -16
- package/es/rce/plugins/shared/ImageCropper/constants.d.ts +1 -1
- package/es/rce/plugins/shared/ImageCropper/constants.js +1 -1
- package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +1 -1
- package/es/rce/plugins/shared/PreviewIcon.js +1 -1
- package/es/rce/plugins/shared/ai_tools/aiicons.d.ts +3 -3
- package/es/rce/plugins/shared/ai_tools/aiicons.js +11 -11
- package/es/rce/plugins/shared/fileTypeUtils.js +1 -1
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +7 -1
- package/es/rce/plugins/tinymce-a11y-checker/plugin.js +50 -52
- package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.d.ts +1 -1
- package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +1 -1
- package/es/rce/style.js +47 -45
- package/es/rcs/api.d.ts +4 -1
- package/es/rcs/api.js +9 -13
- package/es/translations/locales/ar.js +29 -5
- package/es/translations/locales/ca.js +32 -8
- package/es/translations/locales/cy.js +29 -5
- package/es/translations/locales/da-x-k12.js +29 -5
- package/es/translations/locales/da.js +29 -5
- package/es/translations/locales/de.js +29 -5
- package/es/translations/locales/en-AU-x-unimelb.js +29 -5
- package/es/translations/locales/en-GB-x-ukhe.js +29 -5
- package/es/translations/locales/en.js +20 -5
- package/es/translations/locales/en_AU.js +29 -5
- package/es/translations/locales/en_CA.js +29 -5
- package/es/translations/locales/en_CY.js +29 -5
- package/es/translations/locales/en_GB.js +29 -5
- package/es/translations/locales/es.js +29 -5
- package/es/translations/locales/es_ES.js +29 -5
- package/es/translations/locales/fa_IR.js +0 -3
- package/es/translations/locales/fi.js +29 -5
- package/es/translations/locales/fr.js +29 -5
- package/es/translations/locales/fr_CA.js +30 -6
- package/es/translations/locales/ga.js +46 -22
- package/es/translations/locales/hi.js +29 -5
- package/es/translations/locales/ht.js +29 -5
- package/es/translations/locales/hu.js +0 -6
- package/es/translations/locales/id.js +29 -5
- package/es/translations/locales/is.js +23 -5
- package/es/translations/locales/it.js +29 -5
- package/es/translations/locales/ja.js +29 -5
- package/es/translations/locales/mi.js +29 -5
- package/es/translations/locales/ms.js +29 -5
- package/es/translations/locales/nb-x-k12.js +29 -5
- package/es/translations/locales/nb.js +29 -5
- package/es/translations/locales/nl.js +29 -5
- package/es/translations/locales/nn.js +0 -6
- package/es/translations/locales/pl.js +29 -5
- package/es/translations/locales/pt.js +29 -5
- package/es/translations/locales/pt_BR.js +29 -5
- package/es/translations/locales/ru.js +29 -5
- package/es/translations/locales/sl.js +29 -5
- package/es/translations/locales/sv-x-k12.js +29 -5
- package/es/translations/locales/sv.js +29 -5
- package/es/translations/locales/th.js +29 -5
- package/es/translations/locales/uk_UA.js +0 -6
- package/es/translations/locales/vi.js +29 -5
- package/es/translations/locales/zh-Hans.js +29 -5
- package/es/translations/locales/zh-Hant.js +29 -5
- package/es/translations/locales/zh.js +29 -5
- package/es/translations/locales/zh_HK.js +29 -5
- package/es/util/contextHelper.d.ts +7 -0
- package/{testcafe/axe.test.js → es/util/contextHelper.js} +10 -21
- package/es/util/loadingPlaceholder.js +11 -11
- package/eslint.config.js +3 -25
- package/jest/jest-setup.js +27 -2
- package/jest.config.js +5 -1
- package/package.json +62 -85
- package/testcafe/RCEWrapper.test.js +0 -319
- package/testcafe/StatusBar.test.js +0 -108
- package/testcafe/enhanceUserContent.html +0 -58
- package/testcafe/enhanceUserContent.test.js +0 -44
- package/testcafe/entry.jsx +0 -77
- package/testcafe/testcafe.html +0 -14
- package/webpack.testcafe.config.js +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,52 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 7.2.0 - 2025-08-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Block content editor RCE variant support
|
|
12
|
+
- YouTube video overlay
|
|
13
|
+
- Lightest colors and white included in color picker
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Conditionally render screenReader-only Alert in RCEWrapper
|
|
17
|
+
- Canvas-rce translation warnings prevented
|
|
18
|
+
- Background color when RCE is fullscreen
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Upgraded to InstUI 10.24.2
|
|
22
|
+
- Upgraded crypto-es in canvas-rce package
|
|
23
|
+
|
|
24
|
+
### Localization
|
|
25
|
+
- Updated RCE translations for multiple locales
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 7.1.1 - 2025-07-08
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Change color_map to include tiny mce's default light colors and white
|
|
33
|
+
|
|
34
|
+
## 7.1.0 - 2025-06-06
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Change color_map for more accessible default colors
|
|
39
|
+
|
|
40
|
+
## 7.0.0 - 2025-03-31
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- Screen readers for RCE toolbar on mobile platform
|
|
45
|
+
- Axios CSRF vulnerability
|
|
46
|
+
- Mailto link insertion
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- Upgraded Instui to v10
|
|
51
|
+
- Refactored deprecated plugins to prepare for tinymce upgrade
|
|
52
|
+
- Removed media_links_use_attachment_id feature flag
|
|
53
|
+
|
|
8
54
|
## 6.0.0 - 2025-03-20
|
|
9
55
|
|
|
10
56
|
### Changed
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import sinon from 'sinon'
|
|
20
19
|
import indicate from '../../src/common/indicate'
|
|
21
20
|
|
|
22
21
|
describe('indicate function', () => {
|
|
23
|
-
let
|
|
22
|
+
let region, margin, indicator
|
|
24
23
|
|
|
25
24
|
beforeEach(() => {
|
|
26
|
-
|
|
25
|
+
jest.useFakeTimers()
|
|
27
26
|
region = {
|
|
28
27
|
top: 10,
|
|
29
28
|
left: 20,
|
|
@@ -36,7 +35,7 @@ describe('indicate function', () => {
|
|
|
36
35
|
})
|
|
37
36
|
|
|
38
37
|
afterEach(() => {
|
|
39
|
-
|
|
38
|
+
jest.useRealTimers()
|
|
40
39
|
})
|
|
41
40
|
|
|
42
41
|
it('appends a div to the body', () => {
|
|
@@ -44,7 +43,7 @@ describe('indicate function', () => {
|
|
|
44
43
|
})
|
|
45
44
|
|
|
46
45
|
it('removes the div after 2 seconds', () => {
|
|
47
|
-
|
|
46
|
+
jest.advanceTimersByTime(2000)
|
|
48
47
|
expect(indicator.parentNode).toBeNull()
|
|
49
48
|
})
|
|
50
49
|
|
|
@@ -72,7 +71,7 @@ describe('indicate function', () => {
|
|
|
72
71
|
})
|
|
73
72
|
|
|
74
73
|
it('div has leave class after 900ms', () => {
|
|
75
|
-
|
|
74
|
+
jest.advanceTimersByTime(900)
|
|
76
75
|
expect(/leave/.test(indicator.className)).toBeTruthy()
|
|
77
76
|
})
|
|
78
77
|
|
package/es/bridge/Bridge.js
CHANGED
|
@@ -41,6 +41,8 @@ export default class Bridge {
|
|
|
41
41
|
console.warn('clicked sidebar link without a focused editor');
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
+
// insertFileLink is called from the FileBrowser when All files is chosen
|
|
45
|
+
// vs the above insertLink which is called from the other CanvasContentTray panels.
|
|
44
46
|
this.insertFileLink = link => {
|
|
45
47
|
const embedData = fileEmbed(link);
|
|
46
48
|
if (embedData.type === 'image') {
|
|
@@ -192,10 +194,6 @@ export default class Bridge {
|
|
|
192
194
|
}
|
|
193
195
|
return false;
|
|
194
196
|
}
|
|
195
|
-
|
|
196
|
-
// insertFileLink is called from the FileBrowser when All files is chosen
|
|
197
|
-
// vs the above insertLink which is called from the other CanvasContentTray panels.
|
|
198
|
-
|
|
199
197
|
insertImage(image) {
|
|
200
198
|
if (this.focusedEditor) {
|
|
201
199
|
const result = this.focusedEditor.insertImage(image);
|
|
@@ -30,6 +30,8 @@ export const PENDING_MEDIA_ENTRY_ID = 'maybe';
|
|
|
30
30
|
class FileBrowser extends React.Component {
|
|
31
31
|
constructor(_props2) {
|
|
32
32
|
super(_props2);
|
|
33
|
+
// Memoized function to fetch all subfolders
|
|
34
|
+
// of the given folder ID, handing pagination
|
|
33
35
|
this.fetchSubFolders = _.memoize(id => {
|
|
34
36
|
this.source.fetchBookmarkedData(this.source.fetchSubFolders.bind(this.source), {
|
|
35
37
|
folderId: id,
|
|
@@ -214,10 +216,6 @@ class FileBrowser extends React.Component {
|
|
|
214
216
|
this.populateCollectionsList([data], opts);
|
|
215
217
|
this.getFolderData(data.id);
|
|
216
218
|
}
|
|
217
|
-
|
|
218
|
-
// Memoized function to fetch all subfolders
|
|
219
|
-
// of the given folder ID, handing pagination
|
|
220
|
-
|
|
221
219
|
fetchFiles(id) {
|
|
222
220
|
this.source.fetchBookmarkedData(this.source.fetchFilesForFolder.bind(this.source), {
|
|
223
221
|
searchString: this.props.searchString,
|
package/es/common/browser.js
CHANGED
package/es/common/fileUrl.js
CHANGED
|
@@ -21,18 +21,28 @@
|
|
|
21
21
|
// in mocha tests.
|
|
22
22
|
|
|
23
23
|
import RCEGlobals from '../rce/RCEGlobals';
|
|
24
|
+
const CONTACT_PROTOCOLS = ['mailto:', 'tel:', 'skype:'];
|
|
25
|
+
function parseUrl(url, canvasOrigin = window.location.origin) {
|
|
26
|
+
try {
|
|
27
|
+
// If the URL is already absolute, use it as-is
|
|
28
|
+
return new URL(url);
|
|
29
|
+
} catch {
|
|
30
|
+
return new URL(`${canvasOrigin}${url.startsWith('/') ? '' : '/'}${url}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
function parseCanvasUrl(url, canvasOrigin = window.location.origin) {
|
|
25
34
|
if (!url) {
|
|
26
35
|
return null;
|
|
27
36
|
}
|
|
28
37
|
try {
|
|
29
|
-
|
|
30
|
-
const fullUrl = url.startsWith('http') ? url : `${canvasOrigin}${url.startsWith('/') ? '' : '/'}${url}`;
|
|
31
|
-
const parsed = new URL(fullUrl);
|
|
38
|
+
const parsed = parseUrl(url, canvasOrigin);
|
|
32
39
|
const canvasUrl = new URL(canvasOrigin);
|
|
33
40
|
if (parsed.host && canvasUrl.host !== parsed.host) {
|
|
34
41
|
return null;
|
|
35
42
|
}
|
|
43
|
+
if (CONTACT_PROTOCOLS.includes(parsed.protocol)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
36
46
|
|
|
37
47
|
// Convert URLSearchParams to query object
|
|
38
48
|
const query = {};
|
|
@@ -9,6 +9,7 @@ declare const defaultTinymceConfig: {
|
|
|
9
9
|
menubar: undefined;
|
|
10
10
|
menu: undefined;
|
|
11
11
|
toolbar: undefined;
|
|
12
|
+
color_map: string[];
|
|
12
13
|
plugins: undefined;
|
|
13
14
|
branding: boolean;
|
|
14
15
|
browser_spellcheck: boolean;
|
|
@@ -18,7 +19,6 @@ declare const defaultTinymceConfig: {
|
|
|
18
19
|
language_load: boolean;
|
|
19
20
|
language_url: string;
|
|
20
21
|
toolbar_mode: string;
|
|
21
|
-
toolbar_ticky: boolean;
|
|
22
22
|
mobile: {
|
|
23
23
|
theme: string;
|
|
24
24
|
};
|
|
@@ -58,6 +58,42 @@ const defaultTinymceConfig = {
|
|
|
58
58
|
menu: undefined,
|
|
59
59
|
// any toolbar data here will be merged into the standard toolbars
|
|
60
60
|
toolbar: undefined,
|
|
61
|
+
color_map: [
|
|
62
|
+
// First row
|
|
63
|
+
// tiny mce's default first row colors
|
|
64
|
+
'#BFEDD2', 'Light Green', '#FBEEB8', 'Light Orange', '#F8CAC6', 'Light Red', '#ECCAFA', 'Light Purple', '#C2E0F4', 'Light Blue',
|
|
65
|
+
// Second row
|
|
66
|
+
'#03893D',
|
|
67
|
+
// InstUI Green45
|
|
68
|
+
'Green', '#CF4A00',
|
|
69
|
+
// InstUI Orange45
|
|
70
|
+
'Orange', '#E62429',
|
|
71
|
+
// InstUI Red45
|
|
72
|
+
'Red', '#9E58BD',
|
|
73
|
+
// InstUI Violet45
|
|
74
|
+
'Purple', '#2B7ABC',
|
|
75
|
+
// InstUI Blue45
|
|
76
|
+
'Blue',
|
|
77
|
+
// Third row
|
|
78
|
+
'#027634',
|
|
79
|
+
// InstUI Green57
|
|
80
|
+
'Dark Green', '#B34000',
|
|
81
|
+
// InstUI Orange57
|
|
82
|
+
'Dark Orange', '#C71F23',
|
|
83
|
+
// InstUI Red57
|
|
84
|
+
'Dark Red', '#9242B4',
|
|
85
|
+
// InstUI Violet57
|
|
86
|
+
'Dark Purple', '#0E68B3',
|
|
87
|
+
// InstUI Blue57
|
|
88
|
+
'Dark Blue',
|
|
89
|
+
// Fourth row
|
|
90
|
+
'#FFFFFF', 'White', '#6A7883',
|
|
91
|
+
// InstUI Grey45
|
|
92
|
+
'Light Gray', '#3F515E',
|
|
93
|
+
// InstUI Grey82
|
|
94
|
+
'Gray', '#273540',
|
|
95
|
+
// InstUI Grey125
|
|
96
|
+
'Dark Gray', '#000000', 'Black'],
|
|
61
97
|
// plugins included here will be added to the standard set
|
|
62
98
|
plugins: undefined,
|
|
63
99
|
// ==================================================================================
|
|
@@ -69,11 +105,10 @@ const defaultTinymceConfig = {
|
|
|
69
105
|
content_style: '',
|
|
70
106
|
convert_urls: false,
|
|
71
107
|
// fonts specified here need to either be web-safe or self-hosted and loaded in app/stylesheets/bundles/fonts.scss
|
|
72
|
-
font_formats: "Lato Extended=Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Balsamiq Sans=Balsamiq Sans,Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Architect's Daughter=Architects Daughter,Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Courier New=courier new,courier; Georgia=georgia,palatino; Tahoma=tahoma,arial,helvetica,sans-serif; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva",
|
|
108
|
+
font_formats: "Lato Extended=Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Balsamiq Sans=Balsamiq Sans,Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Architect's Daughter=Architects Daughter,Lato Extended,Helvetica Neue,Helvetica,Arial,sans-serif; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Courier New=courier new,courier; Georgia=georgia,palatino; Tahoma=tahoma,arial,helvetica,sans-serif; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Open Dyslexic=OpenDyslexic; Open Dyslexic Mono=OpenDyslexicMono, Monaco, Menlo, Consolas, Courier New, monospace;",
|
|
73
109
|
language_load: false,
|
|
74
110
|
language_url: 'none',
|
|
75
111
|
toolbar_mode: 'floating',
|
|
76
|
-
toolbar_ticky: true,
|
|
77
112
|
mobile: {
|
|
78
113
|
theme: 'silver'
|
|
79
114
|
},
|
|
@@ -92,151 +127,151 @@ const defaultTinymceConfig = {
|
|
|
92
127
|
// this list needs to be kept in sync with the list in gems/canvas_sanitize/lib/canvas_sanitize/canvas_sanitize.rb
|
|
93
128
|
valid_elements: elemsToTinyStringConfig({
|
|
94
129
|
'@': ['id', 'class', 'style', 'title', 'dir<ltr?rtl', 'lang', 'xml::lang', 'role'],
|
|
95
|
-
|
|
130
|
+
a: ['rel', 'rev', 'charset', 'hreflang', 'tabindex', 'accesskey', 'type', 'name', 'href', 'target', 'title', 'class', 'data-old-link'],
|
|
96
131
|
'strong/b': [],
|
|
97
132
|
'em/i': [],
|
|
98
133
|
'strike/s': [],
|
|
99
|
-
|
|
134
|
+
u: [],
|
|
100
135
|
'#p': [],
|
|
101
136
|
'-ol': ['type', 'compact'],
|
|
102
137
|
'-ul': ['type', 'compact'],
|
|
103
138
|
'-li': [],
|
|
104
|
-
|
|
105
|
-
|
|
139
|
+
br: [],
|
|
140
|
+
img: ['longdesc', 'usemap', 'src', 'border', 'alt', 'title', 'hspace', 'vspace', 'width', 'height', 'align', 'role', 'data-old-link'],
|
|
106
141
|
'-sub': [],
|
|
107
142
|
'-sup': [],
|
|
108
143
|
'-blockquote': ['cite'],
|
|
109
144
|
'-table': [{
|
|
110
|
-
|
|
145
|
+
border: '0'
|
|
111
146
|
}, 'cellspacing', 'cellpadding', 'width', 'frame', 'rules', 'height', 'align', 'summary', 'bgcolor', 'background', 'bordercolor'],
|
|
112
147
|
'-tr': ['rowspan', 'width', 'height', 'align', 'valign', 'bgcolor', 'background', 'bordercolor'],
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
148
|
+
tbody: [],
|
|
149
|
+
thead: [],
|
|
150
|
+
tfoot: [],
|
|
116
151
|
'#td': ['colspan', 'rowspan', 'width', 'height', 'align', 'valign', 'bgcolor', 'background', 'bordercolor', 'scope'],
|
|
117
152
|
'#th': ['colspan', 'rowspan', 'width', 'height', 'align', 'valign', 'scope'],
|
|
118
|
-
|
|
153
|
+
caption: [],
|
|
119
154
|
'-div': [],
|
|
120
155
|
'-span': [],
|
|
121
156
|
'-code': [],
|
|
122
157
|
'-pre': [],
|
|
123
|
-
|
|
158
|
+
address: [],
|
|
124
159
|
'-h1': [],
|
|
125
160
|
'-h2': [],
|
|
126
161
|
'-h3': [],
|
|
127
162
|
'-h4': [],
|
|
128
163
|
'-h5': [],
|
|
129
164
|
'-h6': [],
|
|
130
|
-
|
|
165
|
+
hr: ['size', 'noshade'],
|
|
131
166
|
'-font': ['face', 'size', 'color'],
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
dd: [],
|
|
168
|
+
dl: [],
|
|
169
|
+
dt: [],
|
|
170
|
+
cite: [],
|
|
171
|
+
abbr: [],
|
|
172
|
+
acronym: [],
|
|
173
|
+
del: ['datetime', 'cite'],
|
|
174
|
+
ins: ['datetime', 'cite'],
|
|
175
|
+
object: ['classid', 'width', 'height', 'codebase', '*'],
|
|
176
|
+
param: ['name', 'value', '_value'],
|
|
177
|
+
embed: ['type', 'width', 'height', 'src', '*'],
|
|
178
|
+
map: ['name'],
|
|
179
|
+
area: ['shape', 'coords', 'href', 'alt', 'target'],
|
|
180
|
+
bdo: [],
|
|
181
|
+
col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
182
|
+
colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
183
|
+
dfn: [],
|
|
184
|
+
kbd: [],
|
|
185
|
+
q: ['cite'],
|
|
186
|
+
samp: [],
|
|
187
|
+
small: [],
|
|
188
|
+
tt: [],
|
|
189
|
+
var: [],
|
|
190
|
+
big: [],
|
|
191
|
+
figure: [],
|
|
192
|
+
figcaption: [],
|
|
193
|
+
source: ['media', 'width', 'height', 'sizes', 'src', 'srcset', 'type', 'data-old-link'],
|
|
194
|
+
track: [],
|
|
195
|
+
mark: [],
|
|
196
|
+
article: [],
|
|
197
|
+
aside: [],
|
|
198
|
+
details: [],
|
|
199
|
+
footer: [],
|
|
200
|
+
header: [],
|
|
201
|
+
nav: [],
|
|
202
|
+
section: [],
|
|
203
|
+
summary: [],
|
|
204
|
+
time: []
|
|
170
205
|
}),
|
|
171
206
|
extended_valid_elements: elemsToTinyStringConfig({
|
|
172
207
|
'@': ['id', 'accesskey', 'class', 'dir', 'lang', 'style', 'tabindex', 'title', 'contenteditable', 'contextmenu', 'draggable', 'dropzone', 'hidden', 'longdesc', 'spellcheck', 'translate', 'align', 'role', 'aria-labelledby', 'aria-atomic', 'aria-busy', 'aria-controls', 'aria-describedby', 'aria-description', 'aria-disabled', 'aria-dropeffect', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-label', 'aria-labelledby', 'aria-live', 'aria-owns', 'aria-relevant', 'aria-autocomplete', 'aria-checked', 'aria-disabled', 'aria-expanded', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-label', 'aria-level', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-pressed', 'aria-readonly', 'aria-required', 'aria-selected', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext'],
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
208
|
+
iframe: ['id', 'data-media-type', 'title', 'src', 'width', 'height', 'name', 'align', 'style', 'class', 'sandbox', 'loading', 'allowfullscreen', 'webkitallowfullscreen', 'mozallowfullscreen', 'allow', 'data-old-link'],
|
|
209
|
+
i: ['iclass'],
|
|
210
|
+
a: ['hidden', 'href', 'target', 'rel', 'media', 'hreflang', 'type', 'charset', 'name', 'rev', 'shape', 'coords', 'download', 'alt'],
|
|
176
211
|
'#p': [],
|
|
177
|
-
|
|
212
|
+
li: ['value'],
|
|
178
213
|
'-ol': ['reversed', 'start', 'type', 'compact'],
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
214
|
+
pre: ['width'],
|
|
215
|
+
table: ['border', 'summary', 'width', 'frame', 'rules', 'cellspacing', 'cellpadding', 'bgcolor'],
|
|
216
|
+
tbody: ['char', 'charoff', 'valign'],
|
|
217
|
+
td: ['colspan', 'rowspan', 'headers', 'abbr', 'axis', 'scope', 'align', 'char', 'charoff', 'valign', 'nowrap', 'bgcolor', 'width', 'height'],
|
|
218
|
+
tfoot: ['char', 'charoff', 'valign'],
|
|
219
|
+
th: ['colspan', 'rowspan', 'headers', 'scope', 'abbr', 'axis', 'align', 'char', 'charoff', 'valign', 'nowrap', 'bgcolor', 'width', 'height'],
|
|
220
|
+
thead: ['char', 'charoff', 'valign'],
|
|
221
|
+
tr: ['char', 'charoff', 'valign', 'bgcolor'],
|
|
187
222
|
'-ul': ['compact'],
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
223
|
+
video: ['name', 'src', 'allowfullscreen', 'muted', 'poster', 'width', 'height', 'controls', 'playsinline'],
|
|
224
|
+
audio: ['name', 'src', 'muted', 'controls'],
|
|
225
|
+
annotation: ['href', 'xref', 'definitionURL', 'encoding', 'cd', 'name', 'src'],
|
|
191
226
|
'annotation-xml': ['href', 'xref', 'definitionURL', 'encoding', 'cd', 'name', 'src'],
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
227
|
+
maction: ['href', 'xref', 'mathcolor', 'mathbackground', 'actiontype', 'selection'],
|
|
228
|
+
maligngroup: ['href', 'xref', 'mathcolor', 'mathbackground', 'groupalign'],
|
|
229
|
+
malignmark: ['href', 'xref', 'mathcolor', 'mathbackground', 'edge'],
|
|
230
|
+
math: ['xmlns', 'href', 'xref', 'display', 'maxwidth', 'overflow', 'altimg', 'altimg-width', 'altimg-height', 'altimg-valign', 'alttext', 'cdgroup', 'mathcolor', 'mathbackground', 'scriptlevel', 'displaystyle', 'scriptsizemultiplier', 'scriptminsize', 'infixlinebreakstyle', 'decimalpoint', 'mathvariant', 'mathsize', 'width', 'height', 'valign', 'form', 'fence', 'separator', 'lspace', 'rspace', 'stretchy', 'symmetric', 'maxsize', 'minsize', 'largeop', 'movablelimits', 'accent', 'linebreak', 'lineleading', 'linebreakstyle', 'linebreakmultchar', 'indentalign', 'indentshift', 'indenttarget', 'indentalignfirst', 'indentshiftfirst', 'indentalignlast', 'indentshiftlast', 'depth', 'lquote', 'rquote', 'linethickness', 'munalign', 'denomalign', 'bevelled', 'voffset', 'open', 'close', 'separators', 'notation', 'subscriptshift', 'superscriptshift', 'accentunder', 'align', 'rowalign', 'columnalign', 'groupalign', 'alignmentscope', 'columnwidth', 'rowspacing', 'columnspacing', 'rowlines', 'columnlines', 'frame', 'framespacing', 'equalrows', 'equalcolumns', 'side', 'minlabelspacing', 'rowspan', 'columnspan', 'edge', 'stackalign', 'charalign', 'charspacing', 'longdivstyle', 'position', 'shift', 'location', 'crossout', 'length', 'leftoverhang', 'rightoverhang', 'mslinethickness', 'selection'],
|
|
231
|
+
menclose: ['href', 'xref', 'mathcolor', 'mathbackground', 'notation'],
|
|
232
|
+
merror: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
233
|
+
mfenced: ['href', 'xref', 'mathcolor', 'mathbackground', 'open', 'close', 'separators'],
|
|
234
|
+
mfrac: ['href', 'xref', 'mathcolor', 'mathbackground', 'linethickness', 'munalign', 'denomalign', 'bevelled'],
|
|
235
|
+
mglyph: ['href', 'xref', 'mathcolor', 'mathbackground', 'src', 'alt', 'width', 'height', 'valign'],
|
|
236
|
+
mi: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize'],
|
|
237
|
+
mlabeledtr: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
238
|
+
mlongdiv: ['href', 'xref', 'mathcolor', 'mathbackground', 'longdivstyle', 'align', 'stackalign', 'charalign', 'charspacing'],
|
|
239
|
+
mmultiscripts: ['href', 'xref', 'mathcolor', 'mathbackground', 'subscriptshift', 'superscriptshift'],
|
|
240
|
+
mn: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize'],
|
|
241
|
+
mo: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize', 'form', 'fence', 'separator', 'lspace', 'rspace', 'stretchy', 'symmetric', 'maxsize', 'minsize', 'largeop', 'movablelimits', 'accent', 'linebreak', 'lineleading', 'linebreakstyle', 'linebreakmultchar', 'indentalign', 'indentshift', 'indenttarget', 'indentalignfirst', 'indentshiftfirst', 'indentalignlast', 'indentshiftlast'],
|
|
242
|
+
mover: ['href', 'xref', 'mathcolor', 'mathbackground', 'accent', 'align'],
|
|
243
|
+
mpadded: ['href', 'xref', 'mathcolor', 'mathbackground', 'height', 'depth', 'width', 'lspace', 'voffset'],
|
|
244
|
+
mphantom: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
245
|
+
mprescripts: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
246
|
+
mroot: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
247
|
+
mrow: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
248
|
+
ms: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize', 'lquote', 'rquote'],
|
|
249
|
+
mscarries: ['href', 'xref', 'mathcolor', 'mathbackground', 'position', 'location', 'crossout', 'scriptsizemultiplier'],
|
|
250
|
+
mscarry: ['href', 'xref', 'mathcolor', 'mathbackground', 'location', 'crossout'],
|
|
251
|
+
msgroup: ['href', 'xref', 'mathcolor', 'mathbackground', 'position', 'shift'],
|
|
252
|
+
msline: ['href', 'xref', 'mathcolor', 'mathbackground', 'position', 'length', 'leftoverhang', 'rightoverhang', 'mslinethickness'],
|
|
253
|
+
mspace: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize'],
|
|
254
|
+
msqrt: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
255
|
+
msrow: ['href', 'xref', 'mathcolor', 'mathbackground', 'position'],
|
|
256
|
+
mstack: ['href', 'xref', 'mathcolor', 'mathbackground', 'align', 'stackalign', 'charalign', 'charspacing'],
|
|
257
|
+
mstyle: ['href', 'xref', 'mathcolor', 'mathbackground', 'scriptlevel', 'displaystyle', 'scriptsizemultiplier', 'scriptminsize', 'infixlinebreakstyle', 'decimalpoint', 'mathvariant', 'mathsize', 'width', 'height', 'valign', 'form', 'fence', 'separator', 'lspace', 'rspace', 'stretchy', 'symmetric', 'maxsize', 'minsize', 'largeop', 'movablelimits', 'accent', 'linebreak', 'lineleading', 'linebreakstyle', 'linebreakmultchar', 'indentalign', 'indentshift', 'indenttarget', 'indentalignfirst', 'indentshiftfirst', 'indentalignlast', 'indentshiftlast', 'depth', 'lquote', 'rquote', 'linethickness', 'munalign', 'denomalign', 'bevelled', 'voffset', 'open', 'close', 'separators', 'notation', 'subscriptshift', 'superscriptshift', 'accentunder', 'align', 'rowalign', 'columnalign', 'groupalign', 'alignmentscope', 'columnwidth', 'rowspacing', 'columnspacing', 'rowlines', 'columnlines', 'frame', 'framespacing', 'equalrows', 'equalcolumns', 'side', 'minlabelspacing', 'rowspan', 'columnspan', 'edge', 'stackalign', 'charalign', 'charspacing', 'longdivstyle', 'position', 'shift', 'location', 'crossout', 'length', 'leftoverhang', 'rightoverhang', 'mslinethickness', 'selection'],
|
|
258
|
+
msub: ['href', 'xref', 'mathcolor', 'mathbackground', 'subscriptshift'],
|
|
259
|
+
msubsup: ['href', 'xref', 'mathcolor', 'mathbackground', 'subscriptshift', 'superscriptshift'],
|
|
260
|
+
msup: ['href', 'xref', 'mathcolor', 'mathbackground', 'superscriptshift'],
|
|
261
|
+
mtable: ['href', 'xref', 'mathcolor', 'mathbackground', 'align', 'rowalign', 'columnalign', 'groupalign', 'alignmentscope', 'columnwidth', 'width', 'rowspacing', 'columnspacing', 'rowlines', 'columnlines', 'frame', 'framespacing', 'equalrows', 'equalcolumns', 'displaystyle', 'side', 'minlabelspacing'],
|
|
262
|
+
mtd: ['href', 'xref', 'mathcolor', 'mathbackground', 'rowspan', 'columnspan', 'rowalign', 'columnalign', 'groupalign'],
|
|
263
|
+
mtext: ['href', 'xref', 'mathcolor', 'mathbackground', 'mathvariant', 'mathsize', 'width', 'height', 'depth', 'linebreak'],
|
|
264
|
+
mtr: ['href', 'xref', 'mathcolor', 'mathbackground', 'rowalign', 'columnalign', 'groupalign'],
|
|
265
|
+
munder: ['href', 'xref', 'mathcolor', 'mathbackground', 'accentunder', 'align'],
|
|
266
|
+
munderover: ['href', 'xref', 'mathcolor', 'mathbackground', 'accent', 'accentunder', 'align'],
|
|
267
|
+
none: ['href', 'xref', 'mathcolor', 'mathbackground'],
|
|
268
|
+
semantics: ['href', 'xref', 'definitionURL', 'encoding'],
|
|
269
|
+
picture: [],
|
|
270
|
+
ruby: [],
|
|
271
|
+
rp: [],
|
|
272
|
+
rt: [],
|
|
273
|
+
g: ['*'],
|
|
274
|
+
circle: ['*']
|
|
240
275
|
}),
|
|
241
276
|
non_empty_elements: 'td th iframe video audio object script a i area base basefont br col frame hr img input isindex link meta param embed source wbr track ruby',
|
|
242
277
|
// tiny's external link create/edit dialog config
|
|
@@ -25,6 +25,7 @@ import { addParentFrameContextToUrl } from '../rce/plugins/instructure_rce_exter
|
|
|
25
25
|
import { MathJaxDirective, Mathml } from './mathml';
|
|
26
26
|
import { makeExternalLinkIcon } from './external_links';
|
|
27
27
|
import getTranslations from '../getTranslations';
|
|
28
|
+
import { createOverlay } from './youtube_overlay';
|
|
28
29
|
|
|
29
30
|
// in jest the es directory doesn't exist so stub the undefined svg
|
|
30
31
|
const IconDownloadSVG = IconDownloadLine?.src || '<svg></svg>';
|
|
@@ -141,7 +142,8 @@ export function enhanceUserContent(container = document, opts = {}) {
|
|
|
141
142
|
/**
|
|
142
143
|
* Contingency plan in case new instfs media links cause problems in rich content.
|
|
143
144
|
*/
|
|
144
|
-
replaceInstFSLinksWithOldLinks
|
|
145
|
+
replaceInstFSLinksWithOldLinks,
|
|
146
|
+
showYoutubeAdOverlay
|
|
145
147
|
} = opts;
|
|
146
148
|
getTranslations(locale).then(() => {
|
|
147
149
|
formatMessage.setup({
|
|
@@ -155,6 +157,10 @@ export function enhanceUserContent(container = document, opts = {}) {
|
|
|
155
157
|
canvasOrigin,
|
|
156
158
|
disableGooglePreviews
|
|
157
159
|
});
|
|
160
|
+
if (showYoutubeAdOverlay) {
|
|
161
|
+
const youtubeIframes = content.querySelectorAll(['.user_content:not(.enhanced) iframe[src*="youtube.com/embed/"]', '.user_content:not(.enhanced) iframe[src*="youtube-nocookie.com/embed/"]'].join(', '));
|
|
162
|
+
createOverlay(youtubeIframes);
|
|
163
|
+
}
|
|
158
164
|
content.querySelectorAll('.user_content:not(.enhanced)').forEach(elem => {
|
|
159
165
|
elem.classList.add('unenhanced');
|
|
160
166
|
explicit_latex_typesetting && elem.classList.add(MathJaxDirective.Process);
|
|
@@ -93,6 +93,7 @@ export function showFilePreviewInOverlay(event, canvasOrigin) {
|
|
|
93
93
|
const verifier = url?.searchParams.get('verifier');
|
|
94
94
|
const access_token = url?.searchParams.get('access_token');
|
|
95
95
|
const instfs_id = url?.searchParams.get('instfs_id');
|
|
96
|
+
const location = url?.searchParams.get('location');
|
|
96
97
|
const file_id = matches[1];
|
|
97
98
|
const params = {
|
|
98
99
|
subject: 'preview_file',
|
|
@@ -103,6 +104,9 @@ export function showFilePreviewInOverlay(event, canvasOrigin) {
|
|
|
103
104
|
params.access_token = access_token;
|
|
104
105
|
params.instfs_id = instfs_id;
|
|
105
106
|
}
|
|
107
|
+
if (location) {
|
|
108
|
+
params.location = location;
|
|
109
|
+
}
|
|
106
110
|
// TODO:
|
|
107
111
|
// 1. what window should we be using
|
|
108
112
|
// 2. is that the right origin?
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createOverlay: (iframes: NodeListOf<Element>) => void;
|