@instructure/canvas-rce 5.14.2 → 5.15.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 +10 -0
- package/DEVELOPMENT.md +1 -1
- package/es/bridge/Bridge.js +10 -17
- package/es/canvasFileBrowser/FileBrowser.js +10 -19
- package/es/common/FlashAlert.js +8 -11
- package/es/common/fileUrl.js +6 -10
- package/es/common/incremental-loading/LoadMoreButton.js +3 -4
- package/es/common/incremental-loading/LoadingStatus.js +4 -11
- package/es/common/indicate.js +1 -2
- package/es/defaultTinymceConfig.js +1 -1
- package/es/enhance-user-content/doc_previews.js +10 -10
- package/es/enhance-user-content/enhance_user_content.js +4 -7
- package/es/enhance-user-content/external_links.js +1 -1
- package/es/enhance-user-content/instructure_helper.js +11 -17
- package/es/enhance-user-content/mathml.js +15 -27
- package/es/enhance-user-content/media_comment_thumbnail.js +3 -10
- package/es/format-message.js +2 -2
- package/es/index.d.ts +59 -0
- package/es/index.js +3 -5
- package/es/rce/AlertMessageArea.js +15 -16
- package/es/rce/KeyboardShortcutModal.js +2 -2
- package/es/rce/RCE.js +6 -8
- package/es/rce/RCEVariants.js +2 -4
- package/es/rce/RCEWrapper.js +397 -289
- package/es/rce/RCEWrapper.utils.js +131 -0
- package/es/rce/RCEWrapperProps.js +2 -3
- package/es/rce/RceHtmlEditor.js +12 -11
- package/es/rce/ResizeHandle.js +1 -2
- package/es/rce/ShowOnFocusButton/index.js +2 -2
- package/es/rce/StatusBar.js +5 -10
- package/es/rce/contentInsertion.js +1 -2
- package/es/rce/contentRendering.js +6 -5
- package/es/rce/editorLanguage.js +1 -1
- package/es/rce/indicatorRegion.js +1 -2
- package/es/rce/normalizeProps.js +4 -4
- package/es/rce/plugins/instructure_color/clickCallback.js +2 -4
- package/es/rce/plugins/instructure_color/components/ColorPicker.js +17 -22
- package/es/rce/plugins/instructure_color/components/ColorPopup.js +7 -8
- package/es/rce/plugins/instructure_condensed_buttons/ui/list-button.js +4 -10
- package/es/rce/plugins/instructure_condensed_buttons/ui/subscript-superscript-button.js +1 -1
- package/es/rce/plugins/instructure_documents/components/Link.js +1 -2
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +5 -8
- package/es/rce/plugins/instructure_equation/EquationEditorModal/latexTextareaUtil.js +3 -3
- package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +3 -3
- package/es/rce/plugins/instructure_equation/EquationEditorToolbar/buttons.js +2 -2
- package/es/rce/plugins/instructure_equation/EquationEditorToolbar/index.js +9 -11
- package/es/rce/plugins/instructure_equation/MathIcon/index.js +3 -4
- package/es/rce/plugins/instructure_equation/mathlive/index.js +167 -16
- package/es/rce/plugins/instructure_fullscreen/plugin.js +0 -2
- package/es/rce/plugins/instructure_icon_maker/clickCallback.js +3 -4
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ColorSection.js +46 -49
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/CreateIconMakerForm.js +9 -10
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Footer.js +10 -11
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Group.js +5 -6
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Header.js +7 -8
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +7 -9
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageOptions.js +19 -26
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageSection.js +8 -12
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ModeSelect.js +6 -7
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/MultiColor/index.js +5 -6
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGList.js +6 -7
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGThumbnail.js +8 -10
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/index.js +5 -6
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/svg.js +32 -80
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Upload.js +7 -8
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/utils.js +4 -5
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Preview.js +3 -4
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ShapeSection.js +4 -5
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/TextSection.js +4 -5
- package/es/rce/plugins/instructure_icon_maker/components/IconMakerTray.js +22 -29
- package/es/rce/plugins/instructure_icon_maker/registerEditToolbar.js +1 -1
- package/es/rce/plugins/instructure_icon_maker/svg/image.js +5 -7
- package/es/rce/plugins/instructure_icon_maker/svg/index.js +6 -9
- package/es/rce/plugins/instructure_icon_maker/svg/settings.js +17 -20
- package/es/rce/plugins/instructure_icon_maker/svg/shape.js +4 -5
- package/es/rce/plugins/instructure_icon_maker/svg/text.js +28 -32
- package/es/rce/plugins/instructure_icon_maker/svg/utils.js +2 -4
- package/es/rce/plugins/instructure_icon_maker/utils/IconMakerClose.js +2 -3
- package/es/rce/plugins/instructure_icon_maker/utils/iconValidation.js +1 -2
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +3 -7
- package/es/rce/plugins/instructure_image/ImageList/Image.js +7 -8
- package/es/rce/plugins/instructure_image/ImageList/index.js +7 -8
- package/es/rce/plugins/instructure_image/ImageOptionsTray/TrayController.js +2 -4
- package/es/rce/plugins/instructure_image/ImageOptionsTray/index.js +3 -3
- package/es/rce/plugins/instructure_image/plugin.js +1 -2
- package/es/rce/plugins/instructure_links/components/AccordionSection.js +7 -8
- package/es/rce/plugins/instructure_links/components/Link.js +61 -65
- package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/LinkOptionsDialogController.js +1 -2
- package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/index.js +2 -2
- package/es/rce/plugins/instructure_links/components/LinkOptionsTray/index.js +2 -2
- package/es/rce/plugins/instructure_links/components/LinkSet.js +28 -37
- package/es/rce/plugins/instructure_links/components/LinksPanel.js +21 -8
- package/es/rce/plugins/instructure_links/components/NoResults.js +6 -7
- package/es/rce/plugins/instructure_links/plugin.js +6 -9
- package/es/rce/plugins/instructure_media_embed/clickCallback.js +3 -4
- package/es/rce/plugins/instructure_media_embed/components/Embed.js +6 -7
- package/es/rce/plugins/instructure_paste/plugin.js +5 -7
- package/es/rce/plugins/instructure_rce_external_tools/ExternalToolsEnv.js +24 -33
- package/es/rce/plugins/instructure_rce_external_tools/RceToolWrapper.js +7 -38
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +30 -29
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +3 -4
- package/es/rce/plugins/instructure_rce_external_tools/dialog-helper.js +1 -2
- package/es/rce/plugins/instructure_rce_external_tools/jquery/jquery.dropdownList.js +3 -4
- package/es/rce/plugins/instructure_rce_external_tools/lti11-content-items/RceLti11ContentItem.js +17 -24
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/RceLti13ContentItem.js +2 -2
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/BaseLinkContentItem.js +4 -5
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/processEditorContentItems.js +8 -9
- package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/rceLti13ContentItemFromJson.js +0 -1
- package/es/rce/plugins/instructure_rce_external_tools/plugin.js +4 -4
- package/es/rce/plugins/instructure_rce_external_tools/util/externalToolsForToolbar.js +42 -0
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +5 -10
- package/es/rce/plugins/instructure_record/AudioOptionsTray/index.js +12 -13
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +8 -15
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +19 -20
- package/es/rce/plugins/instructure_record/clickCallback.js +26 -30
- package/es/rce/plugins/instructure_search_and_replace/clickCallback.js +2 -3
- package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTray.js +14 -16
- package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTrayController.js +9 -12
- package/es/rce/plugins/instructure_search_and_replace/plugin.js +1 -2
- package/es/rce/plugins/instructure_wordcount/clickCallback.js +3 -4
- package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +26 -33
- package/es/rce/plugins/instructure_wordcount/utils/countContent.js +3 -3
- package/es/rce/plugins/instructure_wordcount/utils/tableContent.js +5 -8
- package/es/rce/plugins/shared/CanvasContentTray.js +9 -16
- package/es/rce/plugins/shared/ColorInput.js +22 -25
- package/es/rce/plugins/shared/ConditionalTooltip.js +5 -6
- package/es/rce/plugins/shared/ContentSelection.js +12 -20
- package/es/rce/plugins/shared/DimensionUtils.js +2 -4
- package/es/rce/plugins/shared/EventUtils.js +1 -1
- package/es/rce/plugins/shared/FixedContentTray.js +13 -14
- package/es/rce/plugins/shared/ImageCropper/DirectionRegion.js +3 -4
- package/es/rce/plugins/shared/ImageCropper/Modal.js +12 -13
- package/es/rce/plugins/shared/ImageCropper/Preview.js +11 -13
- package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +8 -9
- package/es/rce/plugins/shared/ImageCropper/controls/ResetControls.js +3 -4
- package/es/rce/plugins/shared/ImageCropper/controls/RotationControls.js +4 -5
- package/es/rce/plugins/shared/ImageCropper/controls/ShapeControls.js +7 -11
- package/es/rce/plugins/shared/ImageCropper/controls/ZoomControls.js +4 -5
- package/es/rce/plugins/shared/ImageCropper/controls/index.js +4 -5
- package/es/rce/plugins/shared/ImageCropper/controls/useDebouncedNumericValue.js +13 -15
- package/es/rce/plugins/shared/ImageCropper/imageCropUtils.js +18 -21
- package/es/rce/plugins/shared/ImageCropper/svg/shape.js +4 -5
- package/es/rce/plugins/shared/ImageCropper/svg/utils.js +2 -4
- package/es/rce/plugins/shared/ImageCropper/useKeyMouseEvents.js +1 -4
- package/es/rce/plugins/shared/ImageOptionsForm.js +17 -18
- package/es/rce/plugins/shared/LinkDisplay.js +8 -9
- package/es/rce/plugins/shared/PreviewIcon.js +8 -9
- package/es/rce/plugins/shared/RceFileBrowser.js +2 -3
- package/es/rce/plugins/shared/StoreContext.js +8 -10
- package/es/rce/plugins/shared/StudioLtiSupportUtils.js +5 -6
- package/es/rce/plugins/shared/Upload/CanvasContentPanel.js +6 -7
- package/es/rce/plugins/shared/Upload/CategoryProcessor.js +1 -2
- package/es/rce/plugins/shared/Upload/ComputerPanel.js +11 -14
- package/es/rce/plugins/shared/Upload/PanelFilter.js +7 -8
- package/es/rce/plugins/shared/Upload/UploadFile.js +19 -22
- package/es/rce/plugins/shared/Upload/UploadFileModal.js +28 -34
- package/es/rce/plugins/shared/Upload/UrlPanel.js +4 -5
- package/es/rce/plugins/shared/Upload/UsageRightsSelectBox.js +18 -24
- package/es/rce/plugins/shared/Upload/doFileUpload.js +6 -7
- package/es/rce/plugins/shared/ai_tools/AIResponseModal.js +7 -8
- package/es/rce/plugins/shared/ai_tools/AIToolsTray.js +14 -17
- package/es/rce/plugins/shared/ai_tools/aiicons.js +2 -2
- package/es/rce/plugins/shared/canvasContentUtils.js +1 -2
- package/es/rce/plugins/shared/compressionUtils.js +17 -20
- package/es/rce/plugins/shared/do-fetch-api-effect/doFetchApi.js +12 -15
- package/es/rce/plugins/shared/do-fetch-api-effect/get-cookie.js +1 -1
- package/es/rce/plugins/shared/fileTypeUtils.js +3 -6
- package/es/rce/plugins/shared/round.js +1 -2
- package/es/rce/plugins/shared/trayUtils.js +3 -0
- package/es/rce/plugins/shared/useDataUrl.js +4 -5
- package/es/rce/plugins/tinymce-a11y-checker/components/ColorField.js +2 -2
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +8 -10
- package/es/rce/plugins/tinymce-a11y-checker/node-checker.js +1 -3
- package/es/rce/plugins/tinymce-a11y-checker/plugin.js +14 -17
- package/es/rce/plugins/tinymce-a11y-checker/rules/headings-start-at-h2.js +1 -2
- package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +1 -2
- package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +1 -2
- package/es/rce/plugins/tinymce-a11y-checker/utils/dom.js +2 -4
- package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +2 -3
- package/es/rce/plugins/tinymce-a11y-checker/utils/rgb-hex.js +1 -4
- package/es/rce/root.js +9 -9
- package/es/rce/tinyRCE.js +1 -0
- package/es/rce/transformContent.js +1 -1
- package/es/rcs/api.js +39 -55
- package/es/rcs/buildError.js +3 -3
- package/es/rcs/fake.js +5 -7
- package/es/sidebar/actions/documents.js +10 -12
- package/es/sidebar/actions/files.js +18 -22
- package/es/sidebar/actions/filter.js +4 -5
- package/es/sidebar/actions/images.js +20 -26
- package/es/sidebar/actions/media.js +15 -18
- package/es/sidebar/actions/session.js +1 -2
- package/es/sidebar/actions/upload.js +26 -37
- package/es/sidebar/containers/sidebarHandlers.js +6 -12
- package/es/sidebar/dragHtml.js +6 -2
- package/es/sidebar/reducers/all_files.js +1 -3
- package/es/sidebar/reducers/collection.js +1 -3
- package/es/sidebar/reducers/collections.js +1 -3
- package/es/sidebar/reducers/documents.js +1 -3
- package/es/sidebar/reducers/files.js +1 -3
- package/es/sidebar/reducers/filter.js +7 -15
- package/es/sidebar/reducers/flickr.js +1 -3
- package/es/sidebar/reducers/folder.js +1 -3
- package/es/sidebar/reducers/folders.js +1 -3
- package/es/sidebar/reducers/images.js +1 -3
- package/es/sidebar/reducers/media.js +1 -3
- package/es/sidebar/reducers/newPageLinkExpanded.js +1 -3
- package/es/sidebar/reducers/noop.js +1 -2
- package/es/sidebar/reducers/rootFolderId.js +1 -3
- package/es/sidebar/reducers/session.js +1 -3
- package/es/sidebar/reducers/ui.js +3 -9
- package/es/sidebar/reducers/upload.js +8 -24
- package/es/sidebar/store/initialState.js +1 -2
- package/es/translations/locales/ar.js +6 -0
- package/es/translations/locales/ca.js +6 -0
- package/es/translations/locales/cy.js +6 -0
- package/es/translations/locales/da-x-k12.js +6 -0
- package/es/translations/locales/da.js +6 -0
- package/es/translations/locales/de.js +6 -0
- package/es/translations/locales/en-AU-x-unimelb.js +6 -0
- package/es/translations/locales/en-GB-x-ukhe.js +6 -0
- package/es/translations/locales/en_AU.js +6 -0
- package/es/translations/locales/en_CA.js +6 -0
- package/es/translations/locales/en_CY.js +6 -0
- package/es/translations/locales/en_GB.js +6 -0
- package/es/translations/locales/es.js +6 -0
- package/es/translations/locales/es_ES.js +6 -0
- package/es/translations/locales/fi.js +6 -0
- package/es/translations/locales/fr.js +6 -0
- package/es/translations/locales/fr_CA.js +6 -0
- package/es/translations/locales/hi.js +6 -0
- package/es/translations/locales/ht.js +6 -0
- package/es/translations/locales/id.js +6 -0
- package/es/translations/locales/is.js +6 -0
- package/es/translations/locales/it.js +6 -0
- package/es/translations/locales/ja.js +6 -0
- package/es/translations/locales/mi.js +6 -0
- package/es/translations/locales/ms.js +6 -0
- package/es/translations/locales/nb-x-k12.js +6 -0
- package/es/translations/locales/nb.js +6 -0
- package/es/translations/locales/nl.js +6 -0
- package/es/translations/locales/pl.js +6 -0
- package/es/translations/locales/pt.js +6 -0
- package/es/translations/locales/pt_BR.js +6 -0
- package/es/translations/locales/ru.js +6 -0
- package/es/translations/locales/sl.js +6 -0
- package/es/translations/locales/sv-x-k12.js +6 -0
- package/es/translations/locales/sv.js +6 -0
- package/es/translations/locales/th.js +6 -0
- package/es/translations/locales/vi.js +6 -0
- package/es/translations/locales/zh-Hans.js +6 -0
- package/es/translations/locales/zh-Hant.js +6 -0
- package/es/translations/locales/zh.js +6 -0
- package/es/translations/locales/zh_HK.js +6 -0
- package/es/util/elem-util.js +1 -1
- package/es/util/file-url-util.js +1 -1
- package/es/util/fullscreenHelpers.js +6 -9
- package/es/util/loadingPlaceholder.js +2 -3
- package/es/util/simpleCache.js +1 -2
- package/es/util/url-util.js +5 -5
- package/eslint.config.js +15 -4
- package/locales/en.json +190 -10
- package/package.json +56 -55
- package/scripts/installTranslations.js +7 -8
- package/tsconfig.json +1 -1
- package/types/format-message-generate-id.d.ts +22 -0
- package/types/js-beautify.d.ts +21 -0
package/es/rcs/api.js
CHANGED
|
@@ -33,10 +33,9 @@ export function originFromHost(host, windowOverride) {
|
|
|
33
33
|
if (typeof origin !== 'string') {
|
|
34
34
|
origin = '';
|
|
35
35
|
} else if (origin && origin.substr(0, 4) !== 'http') {
|
|
36
|
-
var _windowHandle$locatio;
|
|
37
36
|
origin = `//${origin}`;
|
|
38
37
|
const windowHandle = windowOverride || (typeof window !== 'undefined' ? window : undefined);
|
|
39
|
-
if (origin.length > 0 && windowHandle
|
|
38
|
+
if (origin.length > 0 && windowHandle?.location?.protocol) {
|
|
40
39
|
origin = `${windowHandle.location.protocol}${origin}`;
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -67,7 +66,6 @@ function normalizeFileData(file) {
|
|
|
67
66
|
}
|
|
68
67
|
function throwConnectionError(error) {
|
|
69
68
|
if (error.name === 'TypeError') {
|
|
70
|
-
// eslint-disable-next-line no-console
|
|
71
69
|
console.error(`Failed to fetch from the canvas-rce-api.
|
|
72
70
|
Did you forget to start it or configure it?
|
|
73
71
|
Details can be found at https://github.com/instructure/canvas-rce-api
|
|
@@ -76,8 +74,7 @@ function throwConnectionError(error) {
|
|
|
76
74
|
throw error;
|
|
77
75
|
}
|
|
78
76
|
class RceApiSource {
|
|
79
|
-
constructor() {
|
|
80
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
77
|
+
constructor(options = {}) {
|
|
81
78
|
this.jwt = options.jwt;
|
|
82
79
|
this.host = options.host;
|
|
83
80
|
this.refreshToken = options.refreshToken || defaultRefreshTokenHandler;
|
|
@@ -154,11 +151,10 @@ class RceApiSource {
|
|
|
154
151
|
fetchDocs(props) {
|
|
155
152
|
const documents = props.documents[props.contextType];
|
|
156
153
|
const uri = documents.bookmark || this.uriFor('documents', props);
|
|
157
|
-
return this.apiFetch(uri, headerFor(this.jwt)).then(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} = _ref;
|
|
154
|
+
return this.apiFetch(uri, headerFor(this.jwt)).then(({
|
|
155
|
+
bookmark,
|
|
156
|
+
files
|
|
157
|
+
}) => {
|
|
162
158
|
return {
|
|
163
159
|
bookmark,
|
|
164
160
|
files: files.map(f => fixupFileUrl(props.contextType, props.contextId, f, this.canvasOrigin))
|
|
@@ -166,15 +162,13 @@ class RceApiSource {
|
|
|
166
162
|
});
|
|
167
163
|
}
|
|
168
164
|
fetchMedia(props) {
|
|
169
|
-
var _RCEGlobals$getFeatur;
|
|
170
165
|
const media = props.media[props.contextType];
|
|
171
166
|
const uri = media.bookmark || this.uriFor('media', props);
|
|
172
|
-
if (
|
|
173
|
-
return this.apiFetch(uri, headerFor(this.jwt)).then(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
} = _ref2;
|
|
167
|
+
if (RCEGlobals.getFeatures()?.media_links_use_attachment_id) {
|
|
168
|
+
return this.apiFetch(uri, headerFor(this.jwt)).then(({
|
|
169
|
+
bookmark,
|
|
170
|
+
files
|
|
171
|
+
}) => {
|
|
178
172
|
return {
|
|
179
173
|
bookmark,
|
|
180
174
|
files: files.map(f => fixupFileUrl(props.contextType, props.contextId, f, this.canvasOrigin))
|
|
@@ -184,11 +178,10 @@ class RceApiSource {
|
|
|
184
178
|
return this.apiFetch(uri, headerFor(this.jwt));
|
|
185
179
|
}
|
|
186
180
|
fetchFiles(uri) {
|
|
187
|
-
return this.fetchPage(uri).then(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} = _ref3;
|
|
181
|
+
return this.fetchPage(uri).then(({
|
|
182
|
+
bookmark,
|
|
183
|
+
files
|
|
184
|
+
}) => {
|
|
192
185
|
return {
|
|
193
186
|
bookmark,
|
|
194
187
|
files: files.map(normalizeFileData)
|
|
@@ -221,26 +214,22 @@ class RceApiSource {
|
|
|
221
214
|
};
|
|
222
215
|
return this.apiPost(this.baseUri('media_objects'), headerFor(this.jwt), body);
|
|
223
216
|
}
|
|
224
|
-
updateMediaObject(apiProps,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
} = _ref4;
|
|
231
|
-
const uri = (_RCEGlobals$getFeatur2 = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur2 !== void 0 && _RCEGlobals$getFeatur2.media_links_use_attachment_id && 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)}`;
|
|
217
|
+
updateMediaObject(apiProps, {
|
|
218
|
+
media_object_id,
|
|
219
|
+
title,
|
|
220
|
+
attachment_id
|
|
221
|
+
}) {
|
|
222
|
+
const uri = RCEGlobals.getFeatures()?.media_links_use_attachment_id && 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)}`;
|
|
232
223
|
return this.apiPost(uri, headerFor(this.jwt), null, 'PUT');
|
|
233
224
|
}
|
|
234
225
|
|
|
235
226
|
// PUT to //RCS/api/media_objects/:mediaId/media_tracks [{locale, content}, ...]
|
|
236
227
|
// receive back a 200 with the new subtitles, or a 4xx error
|
|
237
|
-
updateClosedCaptions(apiProps,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
} = _ref5;
|
|
243
|
-
let maxBytes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CONSTANTS.CC_FILE_MAX_BYTES;
|
|
228
|
+
updateClosedCaptions(apiProps, {
|
|
229
|
+
media_object_id,
|
|
230
|
+
attachment_id,
|
|
231
|
+
subtitles
|
|
232
|
+
}, maxBytes = CONSTANTS.CC_FILE_MAX_BYTES) {
|
|
244
233
|
const rcsConfig = {
|
|
245
234
|
origin: originFromHost(apiProps.host),
|
|
246
235
|
headers: headerFor(apiProps.jwt)
|
|
@@ -293,11 +282,10 @@ class RceApiSource {
|
|
|
293
282
|
const uri = bookmark || `${this.baseUri('folders', props.host)}/${props.folderId}`;
|
|
294
283
|
return this.apiFetch(uri, headerFor(this.jwt));
|
|
295
284
|
}
|
|
296
|
-
fetchIconMakerFolder(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
} = _ref6;
|
|
285
|
+
fetchIconMakerFolder({
|
|
286
|
+
contextId,
|
|
287
|
+
contextType
|
|
288
|
+
}) {
|
|
301
289
|
const uri = this.uriFor('folders/icon_maker', {
|
|
302
290
|
contextId,
|
|
303
291
|
contextType,
|
|
@@ -322,11 +310,10 @@ class RceApiSource {
|
|
|
322
310
|
const images = props.images[props.contextType];
|
|
323
311
|
const uri = images.bookmark || this.uriFor('images', props);
|
|
324
312
|
const headers = headerFor(this.jwt);
|
|
325
|
-
return this.apiFetch(uri, headers).then(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
} = _ref7;
|
|
313
|
+
return this.apiFetch(uri, headers).then(({
|
|
314
|
+
bookmark,
|
|
315
|
+
files
|
|
316
|
+
}) => {
|
|
330
317
|
return {
|
|
331
318
|
bookmark,
|
|
332
319
|
files: files.map(f => fixupFileUrl(props.contextType, props.contextId, f, this.canvasOrigin)),
|
|
@@ -426,8 +413,7 @@ class RceApiSource {
|
|
|
426
413
|
const uri = `${base}?term=${encodeURIComponent(term)}`;
|
|
427
414
|
return this.apiFetch(uri, headers);
|
|
428
415
|
}
|
|
429
|
-
getFile(id) {
|
|
430
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
416
|
+
getFile(id, options = {}) {
|
|
431
417
|
const headers = headerFor(this.jwt);
|
|
432
418
|
const base = this.baseUri('file');
|
|
433
419
|
|
|
@@ -470,8 +456,7 @@ class RceApiSource {
|
|
|
470
456
|
}
|
|
471
457
|
return this.apiReallyFetch(uri, headers, options);
|
|
472
458
|
}
|
|
473
|
-
apiReallyFetch(uri, headers) {
|
|
474
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
459
|
+
apiReallyFetch(uri, headers, options = {}) {
|
|
475
460
|
uri = this.normalizeUriProtocol(uri);
|
|
476
461
|
return fetch(uri, {
|
|
477
462
|
headers
|
|
@@ -493,8 +478,7 @@ class RceApiSource {
|
|
|
493
478
|
}
|
|
494
479
|
|
|
495
480
|
// @private
|
|
496
|
-
apiPost(uri, headers, body) {
|
|
497
|
-
let method = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'POST';
|
|
481
|
+
apiPost(uri, headers, body, method = 'POST') {
|
|
498
482
|
headers = {
|
|
499
483
|
...headers,
|
|
500
484
|
'Content-Type': 'application/json'
|
|
@@ -523,7 +507,7 @@ class RceApiSource {
|
|
|
523
507
|
return response;
|
|
524
508
|
}
|
|
525
509
|
}).then(checkStatus).then(res => res.json()).catch(throwConnectionError).catch(e => e.response.json().then(responseBody => {
|
|
526
|
-
console.error(e);
|
|
510
|
+
console.error(e);
|
|
527
511
|
this.alertFunc(buildError(responseBody));
|
|
528
512
|
throw e;
|
|
529
513
|
}));
|
|
@@ -612,6 +596,6 @@ function optionalQuery(props, name) {
|
|
|
612
596
|
return props[name] ? `&${name}=${props[name]}` : '';
|
|
613
597
|
}
|
|
614
598
|
export function getSearchParam(searchString) {
|
|
615
|
-
return
|
|
599
|
+
return searchString?.length >= 3 ? `&search_term=${encodeURIComponent(searchString)}` : '';
|
|
616
600
|
}
|
|
617
601
|
export default RceApiSource;
|
package/es/rcs/buildError.js
CHANGED
|
@@ -39,7 +39,7 @@ function getErrorClass(errorContext, error) {
|
|
|
39
39
|
}
|
|
40
40
|
class QuotaError {
|
|
41
41
|
static isMatch(errorContext) {
|
|
42
|
-
return
|
|
42
|
+
return errorContext?.message === 'file size exceeds quota';
|
|
43
43
|
}
|
|
44
44
|
static build(_error) {
|
|
45
45
|
return {
|
|
@@ -50,7 +50,7 @@ class QuotaError {
|
|
|
50
50
|
}
|
|
51
51
|
class CaptionSizeError {
|
|
52
52
|
static isMatch(_errorContext, error) {
|
|
53
|
-
return
|
|
53
|
+
return error?.name === 'FileSizeError';
|
|
54
54
|
}
|
|
55
55
|
static build(error) {
|
|
56
56
|
return {
|
|
@@ -63,7 +63,7 @@ class CaptionSizeError {
|
|
|
63
63
|
}
|
|
64
64
|
class CaptionCreationError {
|
|
65
65
|
static isMatch(errorContext) {
|
|
66
|
-
return
|
|
66
|
+
return errorContext?.message === 'failed to save captions';
|
|
67
67
|
}
|
|
68
68
|
static build(_error) {
|
|
69
69
|
return {
|
package/es/rcs/fake.js
CHANGED
|
@@ -462,8 +462,7 @@ export function fetchFolders() {
|
|
|
462
462
|
}, 1000);
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
|
-
export function fetchFiles() {
|
|
466
|
-
let uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'files';
|
|
465
|
+
export function fetchFiles(uri = 'files') {
|
|
467
466
|
return Promise.resolve(PAGES[uri]);
|
|
468
467
|
}
|
|
469
468
|
export function fetchImages(props) {
|
|
@@ -577,11 +576,10 @@ export function fetchMedia(state) {
|
|
|
577
576
|
}, FAKE_TIMEOUT);
|
|
578
577
|
});
|
|
579
578
|
}
|
|
580
|
-
export function updateMediaObject(state,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
} = _ref;
|
|
579
|
+
export function updateMediaObject(state, {
|
|
580
|
+
media_object_id,
|
|
581
|
+
title
|
|
582
|
+
}) {
|
|
585
583
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
586
584
|
return new Promise((resolve, reject) => {
|
|
587
585
|
setTimeout(() => {
|
|
@@ -36,12 +36,11 @@ export function requestDocs(contextType) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
export function receiveDocs(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = _ref;
|
|
39
|
+
export function receiveDocs({
|
|
40
|
+
response,
|
|
41
|
+
contextType,
|
|
42
|
+
contextId
|
|
43
|
+
}) {
|
|
45
44
|
const {
|
|
46
45
|
files,
|
|
47
46
|
bookmark
|
|
@@ -56,11 +55,10 @@ export function receiveDocs(_ref) {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
export function failDocs(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = _ref2;
|
|
58
|
+
export function failDocs({
|
|
59
|
+
error,
|
|
60
|
+
contextType
|
|
61
|
+
}) {
|
|
64
62
|
return {
|
|
65
63
|
type: FAIL_DOCS,
|
|
66
64
|
payload: {
|
|
@@ -93,7 +91,7 @@ export function fetchNextDocs() {
|
|
|
93
91
|
return (dispatch, getState) => {
|
|
94
92
|
const state = getState();
|
|
95
93
|
const documents = state.documents[state.contextType];
|
|
96
|
-
if (!
|
|
94
|
+
if (!documents?.isLoading && documents?.hasMore) {
|
|
97
95
|
dispatch(requestDocs(state.contextType));
|
|
98
96
|
return dispatch(fetchDocs());
|
|
99
97
|
}
|
|
@@ -31,14 +31,13 @@ export function createToggle(id) {
|
|
|
31
31
|
id
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
export function createAddFile(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref;
|
|
34
|
+
export function createAddFile({
|
|
35
|
+
id,
|
|
36
|
+
name,
|
|
37
|
+
url,
|
|
38
|
+
type,
|
|
39
|
+
embed
|
|
40
|
+
}) {
|
|
42
41
|
return {
|
|
43
42
|
type: ADD_FILE,
|
|
44
43
|
id,
|
|
@@ -75,11 +74,10 @@ export function requestFiles(id, bookmark) {
|
|
|
75
74
|
folders
|
|
76
75
|
} = getState();
|
|
77
76
|
dispatch(createRequestFiles(id));
|
|
78
|
-
return source.fetchFiles(bookmark || folders[id].filesUrl).then(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} = _ref2;
|
|
77
|
+
return source.fetchFiles(bookmark || folders[id].filesUrl).then(({
|
|
78
|
+
files,
|
|
79
|
+
bookmark
|
|
80
|
+
}) => {
|
|
83
81
|
dispatch(files.map(createAddFile).concat(createReceiveFiles(id, files)));
|
|
84
82
|
if (bookmark) {
|
|
85
83
|
// Page through all in folder, pagination links of a tree may be
|
|
@@ -119,11 +117,10 @@ export function requestSubfolders(id, bookmark) {
|
|
|
119
117
|
folders
|
|
120
118
|
} = getState();
|
|
121
119
|
dispatch(createRequestSubfolders(id));
|
|
122
|
-
return source.fetchPage(bookmark || folders[id].foldersUrl).then(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref3;
|
|
120
|
+
return source.fetchPage(bookmark || folders[id].foldersUrl).then(({
|
|
121
|
+
folders,
|
|
122
|
+
bookmark
|
|
123
|
+
}) => {
|
|
127
124
|
dispatch(folders.map(createAddFolder).concat(createReceiveSubfolders(id, folders, bookmark)));
|
|
128
125
|
if (bookmark) {
|
|
129
126
|
// Page through all in folder, pagination links if a tree may be
|
|
@@ -151,10 +148,9 @@ export function createSetRoot(id) {
|
|
|
151
148
|
}
|
|
152
149
|
export function init(dispatch, getState) {
|
|
153
150
|
const props = getState();
|
|
154
|
-
return props.source.fetchRootFolder(props).then(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} = _ref4;
|
|
151
|
+
return props.source.fetchRootFolder(props).then(({
|
|
152
|
+
folders
|
|
153
|
+
}) => {
|
|
158
154
|
const root = folders[0];
|
|
159
155
|
if (root) {
|
|
160
156
|
dispatch([createAddFolder(root), createSetRoot(root.id)]);
|
|
@@ -21,11 +21,10 @@ export const CHANGE_CONTEXT_TYPE = 'CHANGE_CONTEXT_TYPE';
|
|
|
21
21
|
export const CHANGE_CONTEXT_ID = 'CHANGE_CONTEXT_ID';
|
|
22
22
|
export const CHANGE_SEARCH_STRING = 'CHANGE_SEARCH_STRING';
|
|
23
23
|
export const CHANGE_SORT_BY = 'CHANGE_SORT_BY';
|
|
24
|
-
export function changeContext(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
24
|
+
export function changeContext({
|
|
25
|
+
contextType,
|
|
26
|
+
contextId
|
|
27
|
+
}) {
|
|
29
28
|
return dispatch => {
|
|
30
29
|
dispatch(changeContextType(contextType));
|
|
31
30
|
dispatch(changeContextId(contextId));
|
|
@@ -23,14 +23,13 @@ export const REQUEST_INITIAL_IMAGES = 'action.images.request_initial_images';
|
|
|
23
23
|
export const REQUEST_IMAGES = 'action.images.request_images';
|
|
24
24
|
export const RECEIVE_IMAGES = 'action.images.receive_images';
|
|
25
25
|
export const FAIL_IMAGES_LOAD = 'action.images.fail_images_load';
|
|
26
|
-
export function createAddImage(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} = _ref;
|
|
26
|
+
export function createAddImage({
|
|
27
|
+
id,
|
|
28
|
+
filename,
|
|
29
|
+
display_name,
|
|
30
|
+
url,
|
|
31
|
+
thumbnail_url
|
|
32
|
+
}, contextType) {
|
|
34
33
|
return {
|
|
35
34
|
type: ADD_IMAGE,
|
|
36
35
|
payload: {
|
|
@@ -61,12 +60,11 @@ export function requestImages(contextType) {
|
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
|
-
export function receiveImages(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} = _ref2;
|
|
63
|
+
export function receiveImages({
|
|
64
|
+
response,
|
|
65
|
+
contextType,
|
|
66
|
+
opts = {}
|
|
67
|
+
}) {
|
|
70
68
|
const {
|
|
71
69
|
files,
|
|
72
70
|
bookmark,
|
|
@@ -82,11 +80,10 @@ export function receiveImages(_ref2) {
|
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
82
|
}
|
|
85
|
-
export function failImagesLoad(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} = _ref3;
|
|
83
|
+
export function failImagesLoad({
|
|
84
|
+
error,
|
|
85
|
+
contextType
|
|
86
|
+
}) {
|
|
90
87
|
return {
|
|
91
88
|
type: FAIL_IMAGES_LOAD,
|
|
92
89
|
payload: {
|
|
@@ -109,8 +106,7 @@ export const applyAttributes = (file, opts) => {
|
|
|
109
106
|
// dispatches the start of the load, requests a page for the collection from
|
|
110
107
|
// the source, then dispatches the loaded page to the store on success or
|
|
111
108
|
// clears the load on failure
|
|
112
|
-
export function fetchImages() {
|
|
113
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
109
|
+
export function fetchImages(opts = {}) {
|
|
114
110
|
const {
|
|
115
111
|
category
|
|
116
112
|
} = opts;
|
|
@@ -131,12 +127,11 @@ export function fetchImages() {
|
|
|
131
127
|
}
|
|
132
128
|
// fetches a page only if a page is not already being loaded and the
|
|
133
129
|
// collection is not yet completely loaded
|
|
134
|
-
export function fetchNextImages() {
|
|
135
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
130
|
+
export function fetchNextImages(opts = {}) {
|
|
136
131
|
return (dispatch, getState) => {
|
|
137
132
|
const state = getState();
|
|
138
133
|
const images = state.images[state.contextType];
|
|
139
|
-
if (!
|
|
134
|
+
if (!images?.isLoading && images?.hasMore) {
|
|
140
135
|
dispatch(requestImages(state.contextType));
|
|
141
136
|
return dispatch(fetchImages(opts));
|
|
142
137
|
}
|
|
@@ -144,8 +139,7 @@ export function fetchNextImages() {
|
|
|
144
139
|
}
|
|
145
140
|
// fetches the next page (subject to conditions on fetchNextImages) only if the
|
|
146
141
|
// collection is currently empty
|
|
147
|
-
export function fetchInitialImages() {
|
|
148
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
142
|
+
export function fetchInitialImages(opts = {}) {
|
|
149
143
|
return (dispatch, getState) => {
|
|
150
144
|
const state = getState();
|
|
151
145
|
dispatch(requestInitialImages(state.contextType));
|
|
@@ -38,11 +38,10 @@ export function requestMedia(contextType) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
export function receiveMedia(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref;
|
|
41
|
+
export function receiveMedia({
|
|
42
|
+
response,
|
|
43
|
+
contextType
|
|
44
|
+
}) {
|
|
46
45
|
const {
|
|
47
46
|
files,
|
|
48
47
|
bookmark
|
|
@@ -56,11 +55,10 @@ export function receiveMedia(_ref) {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
export function failMedia(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = _ref2;
|
|
58
|
+
export function failMedia({
|
|
59
|
+
error,
|
|
60
|
+
contextType
|
|
61
|
+
}) {
|
|
64
62
|
return {
|
|
65
63
|
type: FAIL_MEDIA,
|
|
66
64
|
payload: {
|
|
@@ -93,7 +91,7 @@ export function fetchNextMedia() {
|
|
|
93
91
|
return (dispatch, getState) => {
|
|
94
92
|
const state = getState();
|
|
95
93
|
const media = state.media[state.contextType];
|
|
96
|
-
if (!
|
|
94
|
+
if (!media?.isLoading && media?.hasMore) {
|
|
97
95
|
dispatch(requestMedia(state.contextType));
|
|
98
96
|
return dispatch(fetchMedia());
|
|
99
97
|
}
|
|
@@ -111,13 +109,12 @@ export function fetchInitialMedia() {
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
// update the media object.
|
|
114
|
-
export function updateMediaObject(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} = _ref3;
|
|
112
|
+
export function updateMediaObject({
|
|
113
|
+
media_object_id,
|
|
114
|
+
attachment_id,
|
|
115
|
+
title,
|
|
116
|
+
subtitles
|
|
117
|
+
}) {
|
|
121
118
|
return (dispatch, getState) => {
|
|
122
119
|
const state = getState();
|
|
123
120
|
const moUpdate = state.source.updateMediaObject(state, {
|
|
@@ -24,9 +24,8 @@ function receiveSession(data) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
export function get(dispatch, getState) {
|
|
27
|
-
var _source$getSession;
|
|
28
27
|
const {
|
|
29
28
|
source
|
|
30
29
|
} = getState();
|
|
31
|
-
return
|
|
30
|
+
return source.getSession?.().then(data => dispatch(receiveSession(data)));
|
|
32
31
|
}
|