@instructure/canvas-rce 7.3.1 → 8.0.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 +65 -0
- package/{es/rce/plugins/shared/ai_tools/index.js → __mocks__/@instructure/ui-media-player/_mockUiMediaPlayer.js} +4 -4
- package/__tests__/common/mimeClass.test.js +25 -1
- package/__tests__/rcs/api.test.js +280 -251
- package/es/canvasFileBrowser/FileBrowser.d.ts +2 -2
- package/es/canvasFileBrowser/FileBrowser.js +8 -7
- package/es/common/mimeClass.js +3 -1
- package/es/defaultTinymceConfig.js +47 -49
- package/es/enhance-user-content/enhance_user_content.js +6 -8
- package/es/enhance-user-content/index.d.ts +3 -1
- package/es/enhance-user-content/index.js +3 -1
- package/es/enhance-user-content/youtube_overlay.js +18 -0
- package/es/getThemeVars.d.ts +1 -1
- package/es/getThemeVars.js +23 -26
- package/es/rce/KeyboardShortcutModal.js +1 -1
- package/es/rce/RCE.d.ts +9 -0
- package/es/rce/RCE.js +4 -0
- package/es/rce/RCEGlobals.d.ts +2 -0
- package/es/rce/RCEGlobals.js +1 -0
- package/es/rce/RCEVariants.d.ts +1 -2
- package/es/rce/RCEVariants.js +1 -2
- package/es/rce/RCEWrapper.d.ts +6 -16
- package/es/rce/RCEWrapper.js +18 -87
- package/es/rce/RCEWrapper.utils.d.ts +1 -1
- package/es/rce/RCEWrapperProps.d.ts +2 -1
- package/es/rce/RCEWrapperProps.js +2 -1
- package/es/rce/StatusBar.d.ts +0 -1
- package/es/rce/StatusBar.js +3 -28
- package/es/rce/plugins/instructure_equation/EquationEditorModal/advancedOnlySyntax.d.ts +2 -1
- package/es/rce/plugins/instructure_equation/EquationEditorModal/advancedOnlySyntax.js +3 -1
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.d.ts +1 -0
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +12 -2
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageOptions.js +2 -2
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageSection.js +3 -3
- package/es/rce/plugins/instructure_icon_maker/svg/constants.d.ts +20 -5
- package/es/rce/plugins/instructure_icon_maker/svg/utils.d.ts +1 -1
- package/es/rce/plugins/instructure_icon_maker/utils/IconMakerFormHasChanges.js +2 -2
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.d.ts +0 -2
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +2 -9
- package/es/rce/plugins/instructure_paste/plugin.js +18 -12
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.d.ts +1 -1
- package/es/rce/plugins/instructure_rce_external_tools/components/util/ToolLaunchIframe.d.ts +4 -0
- package/es/rce/plugins/instructure_rce_external_tools/components/util/ToolLaunchIframe.js +4 -0
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.d.ts +11 -2
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +92 -10
- package/es/rce/plugins/instructure_record/AudioOptionsTray/index.d.ts +13 -1
- package/es/rce/plugins/instructure_record/AudioOptionsTray/index.js +216 -24
- package/es/rce/plugins/instructure_record/MediaPanel/index.js +16 -5
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.d.ts +14 -13
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +110 -39
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.d.ts +11 -1
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +242 -67
- package/es/rce/plugins/instructure_record/clickCallback.js +19 -4
- package/es/rce/plugins/instructure_record/mediaTranslations.js +1 -1
- package/es/rce/plugins/instructure_record/playerLayoutOptions.d.ts +25 -0
- package/es/rce/plugins/instructure_record/playerLayoutOptions.js +91 -0
- package/es/rce/plugins/instructure_record/plugin.js +2 -5
- package/es/rce/plugins/instructure_record/utils.d.ts +3 -0
- package/es/rce/plugins/instructure_record/utils.js +31 -0
- package/es/rce/plugins/instructure_studio_media_options/plugin.js +82 -26
- package/es/rce/plugins/shared/ContentSelection.d.ts +6 -1
- package/es/rce/plugins/shared/ContentSelection.js +15 -6
- package/es/rce/plugins/shared/DimensionsInput/DimensionInput.js +1 -2
- package/es/rce/plugins/shared/DimensionsInput/index.js +11 -12
- package/es/rce/plugins/shared/DimensionsInput/useDimensionsState.d.ts +1 -1
- package/es/rce/plugins/shared/DimensionsInput/useDimensionsState.js +4 -3
- package/es/rce/plugins/shared/StudioLtiSupportUtils.d.ts +27 -6
- package/es/rce/plugins/shared/StudioLtiSupportUtils.js +82 -13
- package/es/rce/plugins/shared/Upload/UploadFile.js +1 -8
- package/es/rce/style.d.ts +2 -1
- package/es/rce/style.js +4 -2
- package/es/rcs/api.d.ts +5 -10
- package/es/rcs/api.js +15 -21
- package/es/rcs/fake.d.ts +1 -7
- package/es/rcs/fake.js +1 -47
- package/es/sidebar/actions/media.d.ts +19 -6
- package/es/sidebar/actions/media.js +17 -4
- package/es/sidebar/actions/upload.d.ts +3 -3
- package/es/sidebar/actions/upload.js +9 -9
- package/es/sidebar/containers/Sidebar.js +0 -2
- package/es/sidebar/containers/sidebarHandlers.d.ts +2 -4
- package/es/sidebar/containers/sidebarHandlers.js +2 -5
- package/es/sidebar/reducers/index.d.ts +0 -1
- package/es/sidebar/reducers/index.js +0 -2
- package/es/sidebar/store/initialState.d.ts +0 -1
- package/es/sidebar/store/initialState.js +0 -5
- package/es/translations/locales/ar.js +65 -80
- package/es/translations/locales/ca.js +65 -80
- package/es/translations/locales/cy.js +65 -80
- package/es/translations/locales/da-x-k12.js +65 -80
- package/es/translations/locales/da.js +65 -80
- package/es/translations/locales/de.js +65 -80
- package/es/translations/locales/el.js +0 -9
- package/es/translations/locales/en-AU-x-unimelb.js +65 -80
- package/es/translations/locales/en-GB-x-ukhe.js +65 -80
- package/es/translations/locales/en.js +61 -79
- package/es/translations/locales/en_AU.js +65 -80
- package/es/translations/locales/en_CA.js +65 -80
- package/es/translations/locales/en_CY.js +65 -80
- package/es/translations/locales/en_GB.js +65 -80
- package/es/translations/locales/es.js +65 -80
- package/es/translations/locales/es_ES.js +65 -80
- package/es/translations/locales/fa_IR.js +0 -9
- package/es/translations/locales/fi.js +65 -80
- package/es/translations/locales/fr.js +65 -80
- package/es/translations/locales/fr_CA.js +65 -80
- package/es/translations/locales/ga.js +65 -80
- package/es/translations/locales/he.js +0 -9
- package/es/translations/locales/hi.js +65 -80
- package/es/translations/locales/ht.js +65 -80
- package/es/translations/locales/hu.js +0 -36
- package/es/translations/locales/hy.js +0 -9
- package/es/translations/locales/id.js +65 -80
- package/es/translations/locales/is.js +65 -80
- package/es/translations/locales/it.js +65 -80
- package/es/translations/locales/ja.js +65 -80
- package/es/translations/locales/ko.js +2455 -133
- package/es/translations/locales/mi.js +65 -80
- package/es/translations/locales/ms.js +65 -80
- package/es/translations/locales/nb-x-k12.js +65 -80
- package/es/translations/locales/nb.js +65 -80
- package/es/translations/locales/nl.js +66 -81
- package/es/translations/locales/nn.js +0 -36
- package/es/translations/locales/pl.js +65 -80
- package/es/translations/locales/pt.js +65 -80
- package/es/translations/locales/pt_BR.js +65 -80
- package/es/translations/locales/ru.js +65 -80
- package/es/translations/locales/sl.js +65 -80
- package/es/translations/locales/sv-x-k12.js +65 -80
- package/es/translations/locales/sv.js +65 -80
- package/es/translations/locales/th.js +65 -80
- package/es/translations/locales/tr.js +1962 -18
- package/es/translations/locales/uk_UA.js +0 -9
- package/es/translations/locales/vi.js +65 -80
- package/es/translations/locales/zh-Hans.js +65 -80
- package/es/translations/locales/zh-Hant.js +65 -80
- package/es/translations/locales/zh.js +65 -80
- package/es/translations/locales/zh_HK.js +65 -80
- package/eslint.config.js +16 -147
- package/jest/jest-setup.js +1 -0
- package/jest.config.js +2 -0
- package/oxlint.json +84 -0
- package/package.json +86 -62
- package/tsconfig.json +3 -2
- package/es/rce/plugins/shared/ai_tools/AIResponseModal.d.ts +0 -10
- package/es/rce/plugins/shared/ai_tools/AIResponseModal.js +0 -67
- package/es/rce/plugins/shared/ai_tools/AIToolsTray.d.ts +0 -18
- package/es/rce/plugins/shared/ai_tools/AIToolsTray.js +0 -489
- package/es/rce/plugins/shared/ai_tools/aiicons.d.ts +0 -7
- package/es/rce/plugins/shared/ai_tools/aiicons.js +0 -60
- package/es/rce/plugins/shared/ai_tools/index.d.ts +0 -3
- package/es/sidebar/actions/flickr.d.ts +0 -20
- package/es/sidebar/actions/flickr.js +0 -60
- package/es/sidebar/reducers/flickr.d.ts +0 -1
- package/es/sidebar/reducers/flickr.js +0 -49
package/es/rce/style.js
CHANGED
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
import { getThemeVars } from '../getThemeVars';
|
|
20
20
|
import { darken, lighten, alpha } from '@instructure/ui-color-utils';
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
/** @param {boolean} useHighContrast @param {string} [fontFamily] */
|
|
23
|
+
export default function buildStyle(useHighContrast = false, fontFamily) {
|
|
22
24
|
/*
|
|
23
25
|
* If the theme variables to be used when generating the styles below
|
|
24
26
|
* are dependent on the actual theme in use, you can also pull out the
|
|
@@ -28,7 +30,7 @@ export default function buildStyle() {
|
|
|
28
30
|
const {
|
|
29
31
|
variables,
|
|
30
32
|
key
|
|
31
|
-
} = getThemeVars();
|
|
33
|
+
} = getThemeVars(useHighContrast, fontFamily);
|
|
32
34
|
let themeCanvasLinkColor = '';
|
|
33
35
|
let themeCanvasLinkDecoration = '';
|
|
34
36
|
let themeCanvasTextColor = '';
|
package/es/rcs/api.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare class RceApiSource {
|
|
|
26
26
|
formExpanded: boolean;
|
|
27
27
|
};
|
|
28
28
|
initializeImages(props: any): {
|
|
29
|
-
[
|
|
29
|
+
[props.contextType]: {
|
|
30
30
|
files: never[];
|
|
31
31
|
bookmark: null;
|
|
32
32
|
isLoading: boolean;
|
|
@@ -35,7 +35,7 @@ declare class RceApiSource {
|
|
|
35
35
|
searchString: string;
|
|
36
36
|
};
|
|
37
37
|
initializeDocuments(props: any): {
|
|
38
|
-
[
|
|
38
|
+
[props.contextType]: {
|
|
39
39
|
files: never[];
|
|
40
40
|
bookmark: null;
|
|
41
41
|
isLoading: boolean;
|
|
@@ -44,7 +44,7 @@ declare class RceApiSource {
|
|
|
44
44
|
searchString: string;
|
|
45
45
|
};
|
|
46
46
|
initializeMedia(props: any): {
|
|
47
|
-
[
|
|
47
|
+
[props.contextType]: {
|
|
48
48
|
files: never[];
|
|
49
49
|
bookmark: null;
|
|
50
50
|
isLoading: boolean;
|
|
@@ -52,11 +52,6 @@ declare class RceApiSource {
|
|
|
52
52
|
};
|
|
53
53
|
searchString: string;
|
|
54
54
|
};
|
|
55
|
-
initializeFlickr(): {
|
|
56
|
-
searchResults: never[];
|
|
57
|
-
searching: boolean;
|
|
58
|
-
formExpanded: boolean;
|
|
59
|
-
};
|
|
60
55
|
fetchPage(uri: any): Promise<any>;
|
|
61
56
|
fetchBookmarkedData(fetchFunction: any, properties: any, onSuccess: any, onError: any, bookmark: any): any;
|
|
62
57
|
fetchDocs(props: any): Promise<{
|
|
@@ -75,10 +70,11 @@ declare class RceApiSource {
|
|
|
75
70
|
fetchRootFolder(props: any): Promise<any>;
|
|
76
71
|
mediaServerSession(): Promise<any>;
|
|
77
72
|
uploadMediaToCanvas(mediaObject: any): Promise<any>;
|
|
78
|
-
updateMediaObject(apiProps: any, { media_object_id, title, attachment_id }: {
|
|
73
|
+
updateMediaObject(apiProps: any, { media_object_id, title, attachment_id, viewerRestrictions }: {
|
|
79
74
|
media_object_id: any;
|
|
80
75
|
title: any;
|
|
81
76
|
attachment_id: any;
|
|
77
|
+
viewerRestrictions?: {} | undefined;
|
|
82
78
|
}): Promise<any>;
|
|
83
79
|
updateClosedCaptions(apiProps: any, { media_object_id, attachment_id, subtitles }: {
|
|
84
80
|
media_object_id: any;
|
|
@@ -107,7 +103,6 @@ declare class RceApiSource {
|
|
|
107
103
|
uploadFRD(fileDomObject: any, preflightProps: any): Promise<any>;
|
|
108
104
|
finalizeUpload(preflightProps: any, uploadResults: any): Promise<any>;
|
|
109
105
|
setUsageRights(fileId: any, usageRights: any): Promise<any>;
|
|
110
|
-
searchFlickr(term: any, apiProps: any): Promise<any>;
|
|
111
106
|
getFile(id: any, options?: {}): Promise<any>;
|
|
112
107
|
addParamsIfPresent(uri: any, params: any): any;
|
|
113
108
|
apiFetch(uri: any, headers: any, options: any): Promise<any>;
|
package/es/rcs/api.js
CHANGED
|
@@ -125,13 +125,6 @@ class RceApiSource {
|
|
|
125
125
|
initializeMedia(props) {
|
|
126
126
|
return this.initializeDocuments(props);
|
|
127
127
|
}
|
|
128
|
-
initializeFlickr() {
|
|
129
|
-
return {
|
|
130
|
-
searchResults: [],
|
|
131
|
-
searching: false,
|
|
132
|
-
formExpanded: false
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
128
|
|
|
136
129
|
// fetches the given URI and filters it to either an error or parsed response
|
|
137
130
|
fetchPage(uri) {
|
|
@@ -213,10 +206,14 @@ class RceApiSource {
|
|
|
213
206
|
updateMediaObject(apiProps, {
|
|
214
207
|
media_object_id,
|
|
215
208
|
title,
|
|
216
|
-
attachment_id
|
|
209
|
+
attachment_id,
|
|
210
|
+
viewerRestrictions = {}
|
|
217
211
|
}) {
|
|
218
212
|
const uri = attachment_id ? `${this.baseUri('media_attachments', apiProps.host)}/${attachment_id}?user_entered_title=${encodeURIComponent(title)}` : `${this.baseUri('media_objects', apiProps.host)}/${media_object_id}?user_entered_title=${encodeURIComponent(title)}`;
|
|
219
|
-
|
|
213
|
+
const body = {
|
|
214
|
+
viewer_restrictions: viewerRestrictions
|
|
215
|
+
};
|
|
216
|
+
return this.apiPost(uri, headerFor(this.jwt), body, 'PUT');
|
|
220
217
|
}
|
|
221
218
|
|
|
222
219
|
// PUT to //RCS/api/media_objects/:mediaId/media_tracks [{locale, content}, ...]
|
|
@@ -346,7 +343,7 @@ class RceApiSource {
|
|
|
346
343
|
fetchOptions.credentials = 'include';
|
|
347
344
|
}
|
|
348
345
|
return fetch(preflightProps.upload_url, fetchOptions).then(checkStatus).then(res => {
|
|
349
|
-
if (res.headers.get('content-type')
|
|
346
|
+
if (res.headers.get('content-type')?.includes('application/xml')) {
|
|
350
347
|
if (res.status === 201) {
|
|
351
348
|
return res.text().then(text => {
|
|
352
349
|
const xmldoc = new window.DOMParser().parseFromString(text, 'application/xml');
|
|
@@ -403,12 +400,6 @@ class RceApiSource {
|
|
|
403
400
|
};
|
|
404
401
|
return this.apiPost(uri, headers, body);
|
|
405
402
|
}
|
|
406
|
-
searchFlickr(term, apiProps) {
|
|
407
|
-
const headers = headerFor(this.jwt);
|
|
408
|
-
const base = this.baseUri('flickr_search', apiProps.host);
|
|
409
|
-
const uri = `${base}?term=${encodeURIComponent(term)}`;
|
|
410
|
-
return this.apiFetch(uri, headers);
|
|
411
|
-
}
|
|
412
403
|
getFile(id, options = {}) {
|
|
413
404
|
const headers = headerFor(this.jwt);
|
|
414
405
|
const base = this.baseUri('file');
|
|
@@ -502,11 +493,14 @@ class RceApiSource {
|
|
|
502
493
|
} else {
|
|
503
494
|
return response;
|
|
504
495
|
}
|
|
505
|
-
}).then(checkStatus).then(res => res.json()).catch(throwConnectionError).catch(e =>
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
496
|
+
}).then(checkStatus).then(res => res.json()).catch(throwConnectionError).catch(e => {
|
|
497
|
+
if (!e.response) throw e;
|
|
498
|
+
return e.response.json().then(responseBody => {
|
|
499
|
+
console.error(e);
|
|
500
|
+
this.alertFunc(buildError(responseBody));
|
|
501
|
+
throw e;
|
|
502
|
+
});
|
|
503
|
+
});
|
|
510
504
|
}
|
|
511
505
|
|
|
512
506
|
// @private
|
package/es/rcs/fake.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function getSession(): Promise<{
|
|
|
16
16
|
}>;
|
|
17
17
|
export function initializeFolders(): {};
|
|
18
18
|
export function initializeImages(props: any): {
|
|
19
|
-
[
|
|
19
|
+
[props.contextType]: {
|
|
20
20
|
files: never[];
|
|
21
21
|
bookmark: undefined;
|
|
22
22
|
hasMore: boolean;
|
|
@@ -28,11 +28,6 @@ export function initializeUpload(): {
|
|
|
28
28
|
folders: {};
|
|
29
29
|
formExpanded: boolean;
|
|
30
30
|
};
|
|
31
|
-
export function initializeFlickr(): {
|
|
32
|
-
searchResults: never[];
|
|
33
|
-
searching: boolean;
|
|
34
|
-
formExpanded: boolean;
|
|
35
|
-
};
|
|
36
31
|
export function initializeCollection(endpoint: any): {
|
|
37
32
|
links: never[];
|
|
38
33
|
bookmark: any;
|
|
@@ -90,7 +85,6 @@ export function fetchRootFolder(props: any): Promise<{
|
|
|
90
85
|
}[];
|
|
91
86
|
}>;
|
|
92
87
|
export function fetchPage(uri: any): Promise<any>;
|
|
93
|
-
export function searchFlickr(term: any): Promise<any>;
|
|
94
88
|
export function setUsageRights(id: any, usageRights: any): void;
|
|
95
89
|
export function getFile(id: any): Promise<{
|
|
96
90
|
id: any;
|
package/es/rcs/fake.js
CHANGED
|
@@ -317,34 +317,6 @@ const IMAGE_RESPONSES = [{
|
|
|
317
317
|
bookmarkForThis: 'http://canvas/images/3',
|
|
318
318
|
files: images.slice(20)
|
|
319
319
|
}];
|
|
320
|
-
const FLICKR_RESULTS = {
|
|
321
|
-
go: [{
|
|
322
|
-
id: '1',
|
|
323
|
-
href: 'https://farm9.static.flickr.com/8491/8297692520_4e7a43ffcf_s.jpg',
|
|
324
|
-
title: 'Game of Go in our club.'
|
|
325
|
-
}, {
|
|
326
|
-
id: '2',
|
|
327
|
-
href: 'https://farm1.static.flickr.com/5/7270219_6d3f41bc71_s.jpg',
|
|
328
|
-
title: 'Another game of Go'
|
|
329
|
-
}, {
|
|
330
|
-
id: '3',
|
|
331
|
-
href: 'https://farm1.static.flickr.com/8/9686480_c726bf6c5d_s.jpg',
|
|
332
|
-
title: 'the fourth game'
|
|
333
|
-
}],
|
|
334
|
-
chess: [{
|
|
335
|
-
id: '4',
|
|
336
|
-
href: 'https://farm5.static.flickr.com/4051/4627936161_39df5d616a_s.jpg',
|
|
337
|
-
title: 'Chess.'
|
|
338
|
-
}, {
|
|
339
|
-
id: '5',
|
|
340
|
-
href: 'https://farm8.static.flickr.com/7428/9646564428_0e359a1092_s.jpg',
|
|
341
|
-
title: 'chess'
|
|
342
|
-
}, {
|
|
343
|
-
id: '6',
|
|
344
|
-
href: 'https://farm9.static.flickr.com/8309/7961751980_66333f83cf_s.jpg',
|
|
345
|
-
title: 'champion chess'
|
|
346
|
-
}]
|
|
347
|
-
};
|
|
348
320
|
function makeFiles(bookmark_base, extension, content_type) {
|
|
349
321
|
return {
|
|
350
322
|
[`${bookmark_base}1`]: {
|
|
@@ -407,13 +379,6 @@ export function initializeUpload() {
|
|
|
407
379
|
formExpanded: false
|
|
408
380
|
};
|
|
409
381
|
}
|
|
410
|
-
export function initializeFlickr() {
|
|
411
|
-
return {
|
|
412
|
-
searchResults: [],
|
|
413
|
-
searching: false,
|
|
414
|
-
formExpanded: false
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
382
|
export function initializeCollection(endpoint) {
|
|
418
383
|
return {
|
|
419
384
|
links: [],
|
|
@@ -521,20 +486,9 @@ export function fetchPage(uri) {
|
|
|
521
486
|
}, 1000);
|
|
522
487
|
});
|
|
523
488
|
}
|
|
524
|
-
export function searchFlickr(term) {
|
|
525
|
-
return new Promise((resolve, reject) => {
|
|
526
|
-
setTimeout(() => {
|
|
527
|
-
if (FLICKR_RESULTS[term]) {
|
|
528
|
-
resolve(FLICKR_RESULTS[term]);
|
|
529
|
-
} else {
|
|
530
|
-
reject(new Error('No search results!'));
|
|
531
|
-
}
|
|
532
|
-
}, 1000);
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
489
|
export function setUsageRights(id, usageRights) {
|
|
536
490
|
const msg = 'Setting the following usage rights for file (id: %s):';
|
|
537
|
-
console.log(msg, id, usageRights);
|
|
491
|
+
console.log(msg, id, usageRights);
|
|
538
492
|
}
|
|
539
493
|
export function getFile(id) {
|
|
540
494
|
return Promise.resolve({
|
|
@@ -34,12 +34,25 @@ export function failMedia({ error, contextType }: {
|
|
|
34
34
|
export function fetchMedia(): (dispatch: any, getState: any) => any;
|
|
35
35
|
export function fetchNextMedia(): (dispatch: any, getState: any) => any;
|
|
36
36
|
export function fetchInitialMedia(): (dispatch: any, getState: any) => any;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
37
|
+
/**
|
|
38
|
+
* Update a media object's title and optionally its closed captions
|
|
39
|
+
* @param {Object} params
|
|
40
|
+
* @param {string} params.media_object_id - Media object ID
|
|
41
|
+
* @param {string} params.attachment_id - Attachment ID (if video from file upload)
|
|
42
|
+
* @param {string} params.title - New title for the media
|
|
43
|
+
* @param {Array} params.subtitles - Subtitle/caption data (optional)
|
|
44
|
+
* @param {boolean} params.skipCaptionUpdate - If true, skip updating captions even if subtitles provided (default: false)
|
|
45
|
+
* @param {Object} params.viewerRestrictions - Viewer restrictions to apply for this media (default: {})
|
|
46
|
+
* @returns {Function} Redux thunk
|
|
47
|
+
*/
|
|
48
|
+
export function updateMediaObject({ media_object_id, attachment_id, title, subtitles, skipCaptionUpdate, viewerRestrictions, }: {
|
|
49
|
+
media_object_id: string;
|
|
50
|
+
attachment_id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
subtitles: any[];
|
|
53
|
+
skipCaptionUpdate: boolean;
|
|
54
|
+
viewerRestrictions: Object;
|
|
55
|
+
}): Function;
|
|
43
56
|
export const REQUEST_INITIAL_MEDIA: "REQUEST_INITIAL_MEDIA";
|
|
44
57
|
export const REQUEST_MEDIA: "REQUEST_MEDIA";
|
|
45
58
|
export const RECEIVE_MEDIA: "RECEIVE_MEDIA";
|
|
@@ -108,19 +108,32 @@ export function fetchInitialMedia() {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Update a media object's title and optionally its closed captions
|
|
113
|
+
* @param {Object} params
|
|
114
|
+
* @param {string} params.media_object_id - Media object ID
|
|
115
|
+
* @param {string} params.attachment_id - Attachment ID (if video from file upload)
|
|
116
|
+
* @param {string} params.title - New title for the media
|
|
117
|
+
* @param {Array} params.subtitles - Subtitle/caption data (optional)
|
|
118
|
+
* @param {boolean} params.skipCaptionUpdate - If true, skip updating captions even if subtitles provided (default: false)
|
|
119
|
+
* @param {Object} params.viewerRestrictions - Viewer restrictions to apply for this media (default: {})
|
|
120
|
+
* @returns {Function} Redux thunk
|
|
121
|
+
*/
|
|
112
122
|
export function updateMediaObject({
|
|
113
123
|
media_object_id,
|
|
114
124
|
attachment_id,
|
|
115
125
|
title,
|
|
116
|
-
subtitles
|
|
126
|
+
subtitles,
|
|
127
|
+
skipCaptionUpdate = false,
|
|
128
|
+
viewerRestrictions
|
|
117
129
|
}) {
|
|
118
130
|
return (dispatch, getState) => {
|
|
119
131
|
const state = getState();
|
|
120
132
|
const moUpdate = state.source.updateMediaObject(state, {
|
|
121
133
|
media_object_id,
|
|
122
134
|
title,
|
|
123
|
-
attachment_id
|
|
135
|
+
attachment_id,
|
|
136
|
+
viewerRestrictions
|
|
124
137
|
}).catch(e => {
|
|
125
138
|
alertHandler.handleAlert({
|
|
126
139
|
text: formatMessage('Though your video will have the correct title in the browser, we failed to update it in the database.'),
|
|
@@ -135,7 +148,7 @@ export function updateMediaObject({
|
|
|
135
148
|
if (attachment_id) {
|
|
136
149
|
ccData.attachment_id = attachment_id;
|
|
137
150
|
}
|
|
138
|
-
const ccUpdate = state.source.updateClosedCaptions(state, ccData);
|
|
151
|
+
const ccUpdate = skipCaptionUpdate ? Promise.resolve() : state.source.updateClosedCaptions(state, ccData);
|
|
139
152
|
return Promise.all([moUpdate, ccUpdate]);
|
|
140
153
|
};
|
|
141
154
|
}
|
|
@@ -86,19 +86,19 @@ export function allUploadCompleteActions(results: any, fileMetaProps: any, conte
|
|
|
86
86
|
type: string;
|
|
87
87
|
results: any;
|
|
88
88
|
})[];
|
|
89
|
-
export function embedUploadResult(results: any
|
|
89
|
+
export function embedUploadResult(results: any): any;
|
|
90
90
|
export function fetchFolders(bookmark: any): (dispatch: any, getState: any) => any;
|
|
91
91
|
export function mediaUploadComplete(error: any, uploadData: any): (dispatch: any, _getState: any) => void;
|
|
92
92
|
export function createMediaServerSession(): (dispatch: any, getState: any) => any;
|
|
93
93
|
export function uploadToIconMakerFolder(svg: any, uploadSettings?: {}): (_dispatch: any, getState: any) => any;
|
|
94
94
|
export function uploadToMediaFolderWithoutEditor(fileMetaProps: any): (_: any, getState: any) => any;
|
|
95
|
-
export function uploadToMediaFolder(
|
|
95
|
+
export function uploadToMediaFolder(fileMetaProps: any): (dispatch: any, getState: any) => any;
|
|
96
96
|
export function setUsageRights(source: any, fileMetaProps: any, results: any): any;
|
|
97
97
|
export function getFileUrlIfMissing(source: any, results: any): any;
|
|
98
98
|
export function generateThumbnailUrl(results: any, fileDOMObject: any, reader: any): Promise<any>;
|
|
99
99
|
export function setAltText(altText: any, results: any): any;
|
|
100
100
|
export function handleFailures(error: any, dispatch: any): any;
|
|
101
|
-
export function uploadPreflight(
|
|
101
|
+
export function uploadPreflight(fileMetaProps: any): (dispatch: any, getState: any) => Promise<any>;
|
|
102
102
|
export const COMPLETE_FILE_UPLOAD: "COMPLETE_FILE_UPLOAD";
|
|
103
103
|
export const FAIL_FILE_UPLOAD: "FAIL_FILE_UPLOAD";
|
|
104
104
|
export const FAIL_FOLDERS_LOAD: "FAIL_FOLDERS_LOAD";
|
|
@@ -158,9 +158,9 @@ export function allUploadCompleteActions(results, fileMetaProps, contextType) {
|
|
|
158
158
|
}
|
|
159
159
|
return actions;
|
|
160
160
|
}
|
|
161
|
-
export function embedUploadResult(results
|
|
161
|
+
export function embedUploadResult(results) {
|
|
162
162
|
const embedData = fileEmbed(results);
|
|
163
|
-
if (
|
|
163
|
+
if (isImage(embedData.type) && results.displayAs !== 'link') {
|
|
164
164
|
// embed the image after any current selection rather than link to it or replace it
|
|
165
165
|
bridge.activeEditor()?.mceInstance()?.selection.collapse();
|
|
166
166
|
const file_props = {
|
|
@@ -175,7 +175,7 @@ export function embedUploadResult(results, selectedTabType) {
|
|
|
175
175
|
uuid: results.uuid
|
|
176
176
|
};
|
|
177
177
|
return bridge.insertImage(file_props);
|
|
178
|
-
} else if (
|
|
178
|
+
} else if (isAudioOrVideo(embedData.type)) {
|
|
179
179
|
// embed media after any current selection rather than link to it or replace it
|
|
180
180
|
bridge.activeEditor()?.mceInstance()?.selection.collapse();
|
|
181
181
|
|
|
@@ -270,7 +270,7 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
270
270
|
contextType: mediaObject.media_object.context_type
|
|
271
271
|
};
|
|
272
272
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
273
|
-
embedUploadResult(embedData
|
|
273
|
+
embedUploadResult(embedData);
|
|
274
274
|
dispatch(mediaUploadSuccess());
|
|
275
275
|
}
|
|
276
276
|
};
|
|
@@ -386,7 +386,7 @@ export function uploadToMediaFolderWithoutEditor(fileMetaProps) {
|
|
|
386
386
|
});
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
|
-
export function uploadToMediaFolder(
|
|
389
|
+
export function uploadToMediaFolder(fileMetaProps) {
|
|
390
390
|
return (dispatch, getState) => {
|
|
391
391
|
const editorComponent = bridge.activeEditor();
|
|
392
392
|
const bookmark = editorComponent?.editor?.selection.getBookmark(undefined, true);
|
|
@@ -398,7 +398,7 @@ export function uploadToMediaFolder(tabContext, fileMetaProps) {
|
|
|
398
398
|
contextId,
|
|
399
399
|
contextType
|
|
400
400
|
} = getState();
|
|
401
|
-
if (
|
|
401
|
+
if (isAudioOrVideo(fileMetaProps.contentType) && fileMetaProps.domObject) {
|
|
402
402
|
return saveMediaRecording(fileMetaProps.domObject, {
|
|
403
403
|
contextId,
|
|
404
404
|
contextType,
|
|
@@ -420,7 +420,7 @@ export function uploadToMediaFolder(tabContext, fileMetaProps) {
|
|
|
420
420
|
if (fileMetaProps.domObject) {
|
|
421
421
|
delete fileMetaProps.domObject.preview; // don't need this anymore
|
|
422
422
|
}
|
|
423
|
-
return dispatch(uploadPreflight(
|
|
423
|
+
return dispatch(uploadPreflight({
|
|
424
424
|
...fileMetaProps,
|
|
425
425
|
bookmark
|
|
426
426
|
})).then(results => {
|
|
@@ -493,7 +493,7 @@ export function handleFailures(error, dispatch) {
|
|
|
493
493
|
return Promise.resolve().then(() => dispatch(failUpload(error)));
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
export function uploadPreflight(
|
|
496
|
+
export function uploadPreflight(fileMetaProps) {
|
|
497
497
|
return (dispatch, getState) => {
|
|
498
498
|
const {
|
|
499
499
|
source,
|
|
@@ -549,7 +549,7 @@ export function uploadPreflight(tabContext, fileMetaProps) {
|
|
|
549
549
|
contextId,
|
|
550
550
|
...results
|
|
551
551
|
};
|
|
552
|
-
const embedResult = embedUploadResult(uploadResult
|
|
552
|
+
const embedResult = embedUploadResult(uploadResult);
|
|
553
553
|
if (fileMetaProps.bookmark) {
|
|
554
554
|
editorComponent.editor.selection.moveToBookmark(newBookmark);
|
|
555
555
|
}
|
|
@@ -28,7 +28,6 @@ export function propsFromState(state) {
|
|
|
28
28
|
media,
|
|
29
29
|
folders,
|
|
30
30
|
rootFolderId,
|
|
31
|
-
flickr,
|
|
32
31
|
upload,
|
|
33
32
|
session,
|
|
34
33
|
newPageLinkExpanded,
|
|
@@ -53,7 +52,6 @@ export function propsFromState(state) {
|
|
|
53
52
|
media,
|
|
54
53
|
folders,
|
|
55
54
|
rootFolderId,
|
|
56
|
-
flickr,
|
|
57
55
|
upload,
|
|
58
56
|
session,
|
|
59
57
|
newPageLinkExpanded,
|
|
@@ -12,13 +12,11 @@ export default function propsFromDispatch(dispatch: any): {
|
|
|
12
12
|
fetchNextImages: (opts?: {
|
|
13
13
|
category: string;
|
|
14
14
|
}) => any;
|
|
15
|
-
startUpload: (
|
|
16
|
-
flickrSearch: (term: any) => any;
|
|
17
|
-
toggleFlickrForm: () => any;
|
|
15
|
+
startUpload: (fileMetaProps: any) => any;
|
|
18
16
|
toggleUploadForm: () => any;
|
|
19
17
|
toggleNewPageForm: () => any;
|
|
20
18
|
startIconMakerUpload: (fileMetaProps: any, uploadSettings: any) => any;
|
|
21
|
-
startMediaUpload: (
|
|
19
|
+
startMediaUpload: (fileMetaProps: any) => any;
|
|
22
20
|
startMediaUploadInStandaloneMode: (fileMetaProps: any) => any;
|
|
23
21
|
createMediaServerSession: () => any;
|
|
24
22
|
mediaUploadComplete: (error: any, uploadData: any) => any;
|
|
@@ -22,7 +22,6 @@ import { fetchInitialImages, fetchNextImages } from '../actions/images';
|
|
|
22
22
|
import { createMediaServerSession, fetchFolders, openOrCloseUploadForm,
|
|
23
23
|
// saveMediaRecording,
|
|
24
24
|
mediaUploadComplete, uploadPreflight, uploadToIconMakerFolder, uploadToMediaFolder, uploadToMediaFolderWithoutEditor } from '../actions/upload';
|
|
25
|
-
import { searchFlickr, openOrCloseFlickrForm } from '../actions/flickr';
|
|
26
25
|
import { toggle as toggleFolder } from '../actions/files';
|
|
27
26
|
import { openOrCloseNewPageForm } from '../actions/links';
|
|
28
27
|
import { fetchInitialDocs, fetchNextDocs } from '../actions/documents';
|
|
@@ -46,13 +45,11 @@ export default function propsFromDispatch(dispatch) {
|
|
|
46
45
|
fetchNextImages: (opts = {
|
|
47
46
|
category: DEFAULT_FILE_CATEGORY
|
|
48
47
|
}) => dispatch(fetchNextImages(opts)),
|
|
49
|
-
startUpload:
|
|
50
|
-
flickrSearch: term => dispatch(searchFlickr(term)),
|
|
51
|
-
toggleFlickrForm: () => dispatch(openOrCloseFlickrForm()),
|
|
48
|
+
startUpload: fileMetaProps => dispatch(uploadPreflight(fileMetaProps)),
|
|
52
49
|
toggleUploadForm: () => dispatch(openOrCloseUploadForm()),
|
|
53
50
|
toggleNewPageForm: () => dispatch(openOrCloseNewPageForm()),
|
|
54
51
|
startIconMakerUpload: (fileMetaProps, uploadSettings) => dispatch(uploadToIconMakerFolder(fileMetaProps, uploadSettings)),
|
|
55
|
-
startMediaUpload:
|
|
52
|
+
startMediaUpload: fileMetaProps => dispatch(uploadToMediaFolder(fileMetaProps)),
|
|
56
53
|
startMediaUploadInStandaloneMode: fileMetaProps => dispatch(uploadToMediaFolderWithoutEditor(fileMetaProps)),
|
|
57
54
|
createMediaServerSession: () => dispatch(createMediaServerSession()),
|
|
58
55
|
// saveMediaRecording: (file, editor, dismiss) => dispatch(saveMediaRecording(file, editor, dismiss)),
|
|
@@ -26,7 +26,6 @@ import imagesReducer from './images';
|
|
|
26
26
|
import documentsReducer from './documents';
|
|
27
27
|
import mediaReducer from './media';
|
|
28
28
|
import upload from './upload';
|
|
29
|
-
import flickrReducer from './flickr';
|
|
30
29
|
import session from './session';
|
|
31
30
|
import newPageLinkReducer from './newPageLinkExpanded';
|
|
32
31
|
import { changeContextType, changeContextId, changeSearchString, changeSortBy } from './filter';
|
|
@@ -53,7 +52,6 @@ export default combineReducers({
|
|
|
53
52
|
documents: documentsReducer,
|
|
54
53
|
media: mediaReducer,
|
|
55
54
|
upload,
|
|
56
|
-
flickr: flickrReducer,
|
|
57
55
|
session,
|
|
58
56
|
newPageLinkExpanded: newPageLinkReducer
|
|
59
57
|
});
|
|
@@ -52,7 +52,6 @@ export default function (props = {}) {
|
|
|
52
52
|
images,
|
|
53
53
|
documents,
|
|
54
54
|
media,
|
|
55
|
-
flickr,
|
|
56
55
|
newPageLinkExpanded,
|
|
57
56
|
searchString,
|
|
58
57
|
sortBy,
|
|
@@ -111,9 +110,6 @@ export default function (props = {}) {
|
|
|
111
110
|
if (upload === undefined) {
|
|
112
111
|
upload = source.initializeUpload(props);
|
|
113
112
|
}
|
|
114
|
-
if (flickr === undefined) {
|
|
115
|
-
flickr = source.initializeFlickr(props);
|
|
116
|
-
}
|
|
117
113
|
if (images === undefined) {
|
|
118
114
|
images = source.initializeImages(props);
|
|
119
115
|
}
|
|
@@ -152,7 +148,6 @@ export default function (props = {}) {
|
|
|
152
148
|
images,
|
|
153
149
|
documents,
|
|
154
150
|
media,
|
|
155
|
-
flickr,
|
|
156
151
|
newPageLinkExpanded,
|
|
157
152
|
searchString,
|
|
158
153
|
sortBy,
|