@instructure/canvas-rce 5.14.2 → 5.15.1
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.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
|
@@ -83,25 +83,21 @@ export default class TrayController {
|
|
|
83
83
|
media_object_id: audioOptions.media_object_id,
|
|
84
84
|
subtitles: audioOptions.subtitles,
|
|
85
85
|
attachment_id: audioOptions.attachment_id
|
|
86
|
-
}).then(() => container
|
|
87
|
-
// eslint-disable-next-line no-console
|
|
86
|
+
}).then(() => container?.contentWindow.location.reload()).catch(ex => {
|
|
88
87
|
console.error('Failed updating audio captions', ex);
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
requestSubtitlesFromIframe(cb) {
|
|
92
|
-
var _this$_audioContainer, _this$_audioContainer2;
|
|
93
91
|
if (!bridge.canvasOrigin) return;
|
|
94
92
|
this._subtitleListener = new AbortController();
|
|
95
93
|
window.addEventListener('message', event => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var _event$data2;
|
|
99
|
-
cb(event === null || event === void 0 ? void 0 : (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.payload);
|
|
94
|
+
if (event?.data?.subject === 'media_tracks_response') {
|
|
95
|
+
cb(event?.data?.payload);
|
|
100
96
|
}
|
|
101
97
|
}, {
|
|
102
98
|
signal: this._subtitleListener.signal
|
|
103
99
|
});
|
|
104
|
-
|
|
100
|
+
this._audioContainer?.contentWindow?.postMessage({
|
|
105
101
|
subject: 'media_tracks_request'
|
|
106
102
|
}, bridge.canvasOrigin);
|
|
107
103
|
}
|
|
@@ -113,10 +109,9 @@ export default class TrayController {
|
|
|
113
109
|
this._isOpen = true;
|
|
114
110
|
},
|
|
115
111
|
onExited: () => {
|
|
116
|
-
var _this$_subtitleListen;
|
|
117
112
|
bridge.focusActiveEditor(false);
|
|
118
113
|
this._isOpen = false;
|
|
119
|
-
|
|
114
|
+
this._subtitleListener?.abort();
|
|
120
115
|
},
|
|
121
116
|
onSave: options => {
|
|
122
117
|
this._applyAudioOptions(options);
|
|
@@ -27,20 +27,19 @@ import { StoreProvider } from '../../shared/StoreContext';
|
|
|
27
27
|
import Bridge from '../../../../bridge';
|
|
28
28
|
import formatMessage from '../../../../format-message';
|
|
29
29
|
import { getTrayHeight } from '../../shared/trayUtils';
|
|
30
|
-
import {
|
|
30
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
31
31
|
import { Heading } from '@instructure/ui-heading';
|
|
32
32
|
const getLiveRegion = () => document.getElementById('flash_screenreader_holder');
|
|
33
|
-
export default function AudioOptionsTray(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} = _ref;
|
|
33
|
+
export default function AudioOptionsTray({
|
|
34
|
+
open,
|
|
35
|
+
onEntered,
|
|
36
|
+
onExited,
|
|
37
|
+
onDismiss,
|
|
38
|
+
onSave,
|
|
39
|
+
trayProps,
|
|
40
|
+
audioOptions,
|
|
41
|
+
requestSubtitlesFromIframe
|
|
42
|
+
}) {
|
|
44
43
|
const [subtitles, setSubtitles] = useState(audioOptions.tracks || []);
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
if (subtitles.length === 0) requestSubtitlesFromIframe(setSubtitles);
|
|
@@ -57,7 +56,7 @@ export default function AudioOptionsTray(_ref) {
|
|
|
57
56
|
key: "audio-options-tray",
|
|
58
57
|
"data-mce-component": true,
|
|
59
58
|
label: formatMessage('Audio Options Tray'),
|
|
60
|
-
mountNode:
|
|
59
|
+
mountNode: instuiPopupMountNodeFn,
|
|
61
60
|
onDismiss: onDismiss,
|
|
62
61
|
onEntered: onEntered,
|
|
63
62
|
onExited: onExited,
|
|
@@ -68,15 +68,13 @@ export default class TrayController {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
_applyVideoOptions(videoOptions) {
|
|
71
|
-
|
|
72
|
-
if (((_this$$videoContainer = this.$videoContainer) === null || _this$$videoContainer === void 0 ? void 0 : _this$$videoContainer.tagName) === 'IFRAME') {
|
|
71
|
+
if (this.$videoContainer?.tagName === 'IFRAME') {
|
|
73
72
|
const $tinymceIframeShim = this.$videoContainer.parentElement;
|
|
74
73
|
if (videoOptions.displayAs === 'embed') {
|
|
75
|
-
var _videoOptions$subtitl;
|
|
76
74
|
const isVertical = videoOptions.appliedHeight > videoOptions.appliedWidth;
|
|
77
75
|
// player v5 requires more space for the CC button
|
|
78
76
|
// TODO: remove when using v7
|
|
79
|
-
const minWidth =
|
|
77
|
+
const minWidth = videoOptions.subtitles?.length ? 400 : 320;
|
|
80
78
|
const styl = {
|
|
81
79
|
height: `${videoOptions.appliedHeight}px`,
|
|
82
80
|
width: `${Math.max(minWidth, isVertical ? videoOptions.appliedHeight : videoOptions.appliedWidth)}px`
|
|
@@ -130,7 +128,7 @@ export default class TrayController {
|
|
|
130
128
|
}, bridge.canvasOrigin);
|
|
131
129
|
}
|
|
132
130
|
}).catch(ex => {
|
|
133
|
-
console.error('failed updating video captions', ex);
|
|
131
|
+
console.error('failed updating video captions', ex);
|
|
134
132
|
});
|
|
135
133
|
}
|
|
136
134
|
}
|
|
@@ -138,27 +136,23 @@ export default class TrayController {
|
|
|
138
136
|
}
|
|
139
137
|
_dismissTray() {
|
|
140
138
|
if (this.$videoContainer) {
|
|
141
|
-
|
|
142
|
-
(_this$_editor = this._editor) === null || _this$_editor === void 0 ? void 0 : (_this$_editor$selecti = _this$_editor.selection) === null || _this$_editor$selecti === void 0 ? void 0 : _this$_editor$selecti.select(this.$videoContainer);
|
|
139
|
+
this._editor?.selection?.select(this.$videoContainer);
|
|
143
140
|
}
|
|
144
141
|
this._shouldOpen = false;
|
|
145
142
|
this._renderTray();
|
|
146
143
|
this._editor = null;
|
|
147
144
|
}
|
|
148
145
|
requestSubtitlesFromIframe(cb) {
|
|
149
|
-
var _this$$videoContainer2, _this$$videoContainer3;
|
|
150
146
|
if (!bridge.canvasOrigin) return;
|
|
151
147
|
this._subtitleListener = new AbortController();
|
|
152
148
|
window.addEventListener('message', event => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var _event$data2;
|
|
156
|
-
cb(event === null || event === void 0 ? void 0 : (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.payload);
|
|
149
|
+
if (event?.data?.subject === 'media_tracks_response') {
|
|
150
|
+
cb(event?.data?.payload);
|
|
157
151
|
}
|
|
158
152
|
}, {
|
|
159
153
|
signal: this._subtitleListener.signal
|
|
160
154
|
});
|
|
161
|
-
|
|
155
|
+
this.$videoContainer?.contentWindow?.postMessage({
|
|
162
156
|
subject: 'media_tracks_request'
|
|
163
157
|
}, bridge.canvasOrigin);
|
|
164
158
|
}
|
|
@@ -181,10 +175,9 @@ export default class TrayController {
|
|
|
181
175
|
this._isOpen = true;
|
|
182
176
|
},
|
|
183
177
|
onExited: () => {
|
|
184
|
-
var _this$_subtitleListen;
|
|
185
178
|
bridge.focusActiveEditor(false);
|
|
186
179
|
this._isOpen = false;
|
|
187
|
-
|
|
180
|
+
this._subtitleListener?.abort();
|
|
188
181
|
},
|
|
189
182
|
onSave: videoOptions => {
|
|
190
183
|
this._applyVideoOptions(videoOptions);
|
|
@@ -38,23 +38,22 @@ import RceApiSource from '../../../../rcs/api';
|
|
|
38
38
|
import formatMessage from '../../../../format-message';
|
|
39
39
|
import DimensionsInput, { useDimensionsState } from '../../shared/DimensionsInput';
|
|
40
40
|
import { getTrayHeight } from '../../shared/trayUtils';
|
|
41
|
-
import {
|
|
41
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
42
42
|
import { parsedStudioOptionsPropType } from '../../shared/StudioLtiSupportUtils';
|
|
43
43
|
const getLiveRegion = () => document.getElementById('flash_screenreader_holder');
|
|
44
|
-
export default function VideoOptionsTray(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref;
|
|
44
|
+
export default function VideoOptionsTray({
|
|
45
|
+
videoOptions,
|
|
46
|
+
onRequestClose,
|
|
47
|
+
onSave,
|
|
48
|
+
open,
|
|
49
|
+
trayProps,
|
|
50
|
+
requestSubtitlesFromIframe = () => {},
|
|
51
|
+
onEntered = null,
|
|
52
|
+
onExited = null,
|
|
53
|
+
id = 'video-options-tray',
|
|
54
|
+
studioOptions = null,
|
|
55
|
+
forBlockEditorUse = false
|
|
56
|
+
}) {
|
|
58
57
|
const {
|
|
59
58
|
naturalHeight,
|
|
60
59
|
naturalWidth
|
|
@@ -86,7 +85,7 @@ export default function VideoOptionsTray(_ref) {
|
|
|
86
85
|
api.getFile(videoOptions.attachmentId, {
|
|
87
86
|
include: ['blueprint_course_status']
|
|
88
87
|
}).then(response => {
|
|
89
|
-
setEditLocked(
|
|
88
|
+
setEditLocked(response?.restricted_by_master_course && response?.is_master_course_child_content);
|
|
90
89
|
setLoading(false);
|
|
91
90
|
}).catch(error => {
|
|
92
91
|
setLoading(false);
|
|
@@ -175,7 +174,7 @@ export default function VideoOptionsTray(_ref) {
|
|
|
175
174
|
key: "video-options-tray",
|
|
176
175
|
"data-mce-component": true,
|
|
177
176
|
label: isStudio ? formatMessage('Studio Media Options Tray') : formatMessage('Video Options Tray'),
|
|
178
|
-
mountNode:
|
|
177
|
+
mountNode: instuiPopupMountNodeFn,
|
|
179
178
|
onDismiss: onRequestClose,
|
|
180
179
|
onEntered: onEntered,
|
|
181
180
|
onExited: onExited,
|
|
@@ -207,7 +206,7 @@ export default function VideoOptionsTray(_ref) {
|
|
|
207
206
|
margin: "xx-large",
|
|
208
207
|
padding: "xx-large"
|
|
209
208
|
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
210
|
-
renderTitle: formatMessage(
|
|
209
|
+
renderTitle: formatMessage('Loading')
|
|
211
210
|
})) : /*#__PURE__*/React.createElement(Flex.Item, {
|
|
212
211
|
as: "form",
|
|
213
212
|
shouldGrow: true,
|
|
@@ -261,7 +260,7 @@ export default function VideoOptionsTray(_ref) {
|
|
|
261
260
|
padding: "small small xx-small small"
|
|
262
261
|
}, /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
263
262
|
id: `${id}-size`,
|
|
264
|
-
mountNode:
|
|
263
|
+
mountNode: instuiPopupMountNodeFn,
|
|
265
264
|
disabled: displayAs !== 'embed',
|
|
266
265
|
renderLabel: formatMessage('Size'),
|
|
267
266
|
messages: messagesForSize,
|
|
@@ -298,7 +297,7 @@ export default function VideoOptionsTray(_ref) {
|
|
|
298
297
|
userLocale: Bridge.userLocale,
|
|
299
298
|
updateSubtitles: handleUpdateSubtitles,
|
|
300
299
|
liveRegion: getLiveRegion,
|
|
301
|
-
mountNode:
|
|
300
|
+
mountNode: instuiPopupMountNodeFn
|
|
302
301
|
}))))), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
303
302
|
background: "secondary",
|
|
304
303
|
borderWidth: "small none none none",
|
|
@@ -22,11 +22,11 @@ import Bridge from '../../../bridge';
|
|
|
22
22
|
import { StoreProvider } from '../shared/StoreContext';
|
|
23
23
|
import formatMessage from '../../../format-message';
|
|
24
24
|
import { headerFor, originFromHost } from '../../../rcs/api';
|
|
25
|
-
import {
|
|
25
|
+
import { instuiPopupMountNodeFn } from '../../../util/fullscreenHelpers';
|
|
26
26
|
import RCEGlobals from '../../RCEGlobals';
|
|
27
27
|
export const handleUpload = (error, uploadData, onUploadComplete, uploadBookmark) => {
|
|
28
28
|
let err_msg = error && Bridge.uploadMediaTranslations.UploadMediaStrings.UPLOADING_ERROR;
|
|
29
|
-
if (
|
|
29
|
+
if (error?.name === 'FileSizeError') {
|
|
30
30
|
err_msg = formatMessage('Size of caption file is greater than the maximum {max} kb allowed file size.', {
|
|
31
31
|
max: error.maxBytes / 1000
|
|
32
32
|
});
|
|
@@ -64,39 +64,35 @@ export default function (ed, document) {
|
|
|
64
64
|
// but it also does the upload. We need to separate them if we
|
|
65
65
|
// want to stay within the redux approach
|
|
66
66
|
const handleStartUpload = fileProps => {
|
|
67
|
-
var _editorComponent$edit;
|
|
68
67
|
Bridge.focusEditor(ed.rceWrapper);
|
|
69
68
|
const editorComponent = Bridge.activeEditor();
|
|
70
|
-
uploadBookmark = editorComponent
|
|
69
|
+
uploadBookmark = editorComponent?.editor?.selection.getBookmark(2, true);
|
|
71
70
|
Bridge.insertImagePlaceholder(fileProps);
|
|
72
71
|
handleDismiss();
|
|
73
72
|
};
|
|
74
73
|
const trayProps = Bridge.trayProps.get(ed);
|
|
75
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(StoreProvider, trayProps, contentProps => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
useStudioPlayer: (_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) === null || _RCEGlobals$getFeatur === void 0 ? void 0 : _RCEGlobals$getFeatur.consolidated_media_player
|
|
99
|
-
});
|
|
100
|
-
}), container);
|
|
74
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(StoreProvider, trayProps, contentProps => /*#__PURE__*/React.createElement(UploadMedia, {
|
|
75
|
+
"data-mce-component": true,
|
|
76
|
+
rcsConfig: {
|
|
77
|
+
contextType: ed.settings.canvas_rce_user_context.type,
|
|
78
|
+
contextId: ed.settings.canvas_rce_user_context.id,
|
|
79
|
+
origin: originFromHost(contentProps.host),
|
|
80
|
+
headers: headerFor(contentProps.jwt)
|
|
81
|
+
},
|
|
82
|
+
userLocale: Bridge.userLocale,
|
|
83
|
+
mountNode: instuiPopupMountNodeFn,
|
|
84
|
+
open: true,
|
|
85
|
+
liveRegion: () => document.getElementById('flash_screenreader_holder'),
|
|
86
|
+
onStartUpload: fileProps => handleStartUpload(fileProps),
|
|
87
|
+
onUploadComplete: (err, data) => handleUpload(err, data, contentProps.mediaUploadComplete, uploadBookmark),
|
|
88
|
+
onDismiss: handleDismiss,
|
|
89
|
+
tabs: {
|
|
90
|
+
record: true,
|
|
91
|
+
upload: true
|
|
92
|
+
},
|
|
93
|
+
uploadMediaTranslations: Bridge.uploadMediaTranslations,
|
|
94
|
+
media_links_use_attachment_id: RCEGlobals.getFeatures().media_links_use_attachment_id,
|
|
95
|
+
useStudioPlayer: RCEGlobals.getFeatures()?.consolidated_media_player
|
|
96
|
+
})), container);
|
|
101
97
|
});
|
|
102
98
|
}
|
|
@@ -22,12 +22,11 @@ import FindReplaceController from './components/FindReplaceTrayController';
|
|
|
22
22
|
import { getSelectionContext } from './getSelectionContext';
|
|
23
23
|
const CONTAINER_ID = 'instructure-find-replace-tray-container';
|
|
24
24
|
export default function (editor, document) {
|
|
25
|
-
var _editor$selection, _editor$selection2;
|
|
26
25
|
const plugin = editor.plugins.searchreplace;
|
|
27
|
-
const initalSelection =
|
|
26
|
+
const initalSelection = editor.selection?.getContent({
|
|
28
27
|
format: 'text'
|
|
29
28
|
});
|
|
30
|
-
if (initalSelection)
|
|
29
|
+
if (initalSelection) editor.selection?.collapse(true);
|
|
31
30
|
let container = document.getElementById(CONTAINER_ID);
|
|
32
31
|
if (container == null) {
|
|
33
32
|
container = document.createElement('div');
|
|
@@ -24,25 +24,24 @@ import { Heading } from '@instructure/ui-heading';
|
|
|
24
24
|
import { IconWarningSolid } from '@instructure/ui-icons';
|
|
25
25
|
import { getTrayHeight } from '../../shared/trayUtils';
|
|
26
26
|
import { View } from '@instructure/ui-view';
|
|
27
|
-
import {
|
|
27
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
28
28
|
import formatMessage from '../../../../format-message';
|
|
29
29
|
import { Tray } from '@instructure/ui-tray';
|
|
30
30
|
import { TextInput } from '@instructure/ui-text-input';
|
|
31
31
|
import { Text } from '@instructure/ui-text';
|
|
32
32
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
33
33
|
import { Alert } from '@instructure/ui-alerts';
|
|
34
|
-
export default function FindReplaceTray(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref;
|
|
34
|
+
export default function FindReplaceTray({
|
|
35
|
+
onNext,
|
|
36
|
+
onPrevious,
|
|
37
|
+
onFind,
|
|
38
|
+
onRequestClose,
|
|
39
|
+
onReplace,
|
|
40
|
+
index,
|
|
41
|
+
max,
|
|
42
|
+
initialText = '',
|
|
43
|
+
selectionContext = ['', '']
|
|
44
|
+
}) {
|
|
46
45
|
const [findText, setFindText] = useState(initialText);
|
|
47
46
|
const [replaceText, setReplaceText] = useState('');
|
|
48
47
|
const [hasOpened, setHasOpened] = useState(false);
|
|
@@ -54,13 +53,12 @@ export default function FindReplaceTray(_ref) {
|
|
|
54
53
|
const srDupKey = useRef(0);
|
|
55
54
|
// moves RCE when tray opens/closes, copied from CanvasContentTray
|
|
56
55
|
useEffect(() => {
|
|
57
|
-
var _trayRef$current;
|
|
58
56
|
if (!hasOpened) return;
|
|
59
57
|
let c = document.querySelector('[role="main"]');
|
|
60
58
|
let target_w = 0;
|
|
61
59
|
if (!c) return;
|
|
62
60
|
const margin = window.getComputedStyle(c).direction === 'ltr' ? document.body.getBoundingClientRect().right - c.getBoundingClientRect().right : c.getBoundingClientRect().left;
|
|
63
|
-
target_w = c.offsetWidth -
|
|
61
|
+
target_w = c.offsetWidth - trayRef.current?.offsetWidth + margin;
|
|
64
62
|
if (target_w >= 320 && target_w < c.offsetWidth) {
|
|
65
63
|
c.style.boxSizing = 'border-box';
|
|
66
64
|
c.style.width = `${target_w}px`;
|
|
@@ -214,7 +212,7 @@ export default function FindReplaceTray(_ref) {
|
|
|
214
212
|
return /*#__PURE__*/React.createElement(Tray, {
|
|
215
213
|
"data-mce-component": true,
|
|
216
214
|
label: formatMessage('Find and Replace'),
|
|
217
|
-
mountNode:
|
|
215
|
+
mountNode: instuiPopupMountNodeFn(),
|
|
218
216
|
onDismiss: onRequestClose,
|
|
219
217
|
open: true,
|
|
220
218
|
placement: "end",
|
package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTrayController.js
CHANGED
|
@@ -19,14 +19,13 @@ import _pt from "prop-types";
|
|
|
19
19
|
|
|
20
20
|
import React, { useState } from 'react';
|
|
21
21
|
import FindReplaceTray from './FindReplaceTray';
|
|
22
|
-
export default function FindReplaceTrayController(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
22
|
+
export default function FindReplaceTrayController({
|
|
23
|
+
plugin,
|
|
24
|
+
onDismiss,
|
|
25
|
+
initialText = '',
|
|
26
|
+
undoManager,
|
|
27
|
+
getSelectionContext
|
|
28
|
+
}) {
|
|
30
29
|
// this component really just exists to make the index easier to track
|
|
31
30
|
const [findIndex, setFindIndex] = useState(0);
|
|
32
31
|
const [findCount, setFindCount] = useState(0);
|
|
@@ -83,11 +82,9 @@ export default function FindReplaceTrayController(_ref) {
|
|
|
83
82
|
updateSelectionContext();
|
|
84
83
|
}
|
|
85
84
|
};
|
|
86
|
-
const handleReplace =
|
|
87
|
-
let forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
88
|
-
let all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
85
|
+
const handleReplace = (text, forward = true, all = false) => {
|
|
89
86
|
if (!text) return;
|
|
90
|
-
undoManager
|
|
87
|
+
undoManager?.add();
|
|
91
88
|
plugin.replace(text, forward, all);
|
|
92
89
|
if (findCount === 1 || all) {
|
|
93
90
|
done();
|
|
@@ -20,9 +20,8 @@ import tinymce from 'tinymce';
|
|
|
20
20
|
import formatMessage from '../../../format-message';
|
|
21
21
|
import clickCallback from './clickCallback';
|
|
22
22
|
tinymce.PluginManager.add('instructure_search_and_replace', function (editor) {
|
|
23
|
-
var _editor$plugins;
|
|
24
23
|
// We use the searchreplace plugins API
|
|
25
|
-
if (!
|
|
24
|
+
if (!editor.plugins?.searchreplace) return;
|
|
26
25
|
const launchFindModal = ed => () => {
|
|
27
26
|
clickCallback(ed, document);
|
|
28
27
|
};
|
|
@@ -21,10 +21,9 @@ import ReactDOM from 'react-dom';
|
|
|
21
21
|
import { generateRows, HEADERS } from './utils/tableContent';
|
|
22
22
|
const MODAL_ID = 'canvas-rce-wordcount-container';
|
|
23
23
|
export default function (ed, document, options) {
|
|
24
|
-
return import('./components/WordCountModal').then(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
24
|
+
return import('./components/WordCountModal').then(({
|
|
25
|
+
WordCountModal
|
|
26
|
+
}) => {
|
|
28
27
|
let container = document.querySelector(`#${MODAL_ID}`);
|
|
29
28
|
if (!container) {
|
|
30
29
|
container = document.createElement('div');
|
|
@@ -23,45 +23,38 @@ import { BaseButton, CloseButton } from '@instructure/ui-buttons';
|
|
|
23
23
|
import { Heading } from '@instructure/ui-heading';
|
|
24
24
|
import { Table } from '@instructure/ui-table';
|
|
25
25
|
import formatMessage from '../../../../format-message';
|
|
26
|
-
import {
|
|
26
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
27
27
|
const renderBody = (headers, rows) => {
|
|
28
28
|
return /*#__PURE__*/React.createElement(Table, {
|
|
29
29
|
caption: formatMessage('Word Count')
|
|
30
|
-
}, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, headers.map(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, label), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
50
|
-
key: "document"
|
|
51
|
-
}, documentCount), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
52
|
-
key: "selection"
|
|
53
|
-
}, selectionCount));
|
|
54
|
-
})));
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, headers.map(({
|
|
31
|
+
id,
|
|
32
|
+
getLabel
|
|
33
|
+
}) => /*#__PURE__*/React.createElement(Table.ColHeader, {
|
|
34
|
+
key: id,
|
|
35
|
+
id: id
|
|
36
|
+
}, getLabel())))), /*#__PURE__*/React.createElement(Table.Body, null, rows.map(({
|
|
37
|
+
label,
|
|
38
|
+
documentCount,
|
|
39
|
+
selectionCount
|
|
40
|
+
}) => /*#__PURE__*/React.createElement(Table.Row, {
|
|
41
|
+
key: label
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Table.Cell, {
|
|
43
|
+
key: "label"
|
|
44
|
+
}, label), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
45
|
+
key: "document"
|
|
46
|
+
}, documentCount), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
47
|
+
key: "selection"
|
|
48
|
+
}, selectionCount)))));
|
|
55
49
|
};
|
|
56
|
-
export const WordCountModal =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} = _ref3;
|
|
50
|
+
export const WordCountModal = ({
|
|
51
|
+
headers,
|
|
52
|
+
rows,
|
|
53
|
+
onDismiss
|
|
54
|
+
}) => {
|
|
62
55
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
63
56
|
label: formatMessage('Word Count'),
|
|
64
|
-
mountNode:
|
|
57
|
+
mountNode: instuiPopupMountNodeFn(),
|
|
65
58
|
open: true,
|
|
66
59
|
"data-mce-component": true
|
|
67
60
|
}, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(CloseButton, {
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
export const IGNORE_WORDCOUNT_ATTRIBUTE = 'data-ignore-wordcount';
|
|
20
20
|
export const countWords = node => {
|
|
21
21
|
if (node.getAttribute(IGNORE_WORDCOUNT_ATTRIBUTE) === 'chars-only') return 0;
|
|
22
|
-
const textContent =
|
|
22
|
+
const textContent = node?.innerText || '';
|
|
23
23
|
const trimmedTextContent = textContent.trim();
|
|
24
24
|
if (trimmedTextContent.length === 0) return 0;
|
|
25
25
|
return trimmedTextContent.split(/\s+/).length;
|
|
26
26
|
};
|
|
27
27
|
export const countCharsNoSpaces = node => {
|
|
28
|
-
const textContent =
|
|
28
|
+
const textContent = node?.innerText || '';
|
|
29
29
|
const matches = textContent.match(/ /g); // a single space
|
|
30
30
|
const spaces = matches ? matches.length : 0;
|
|
31
31
|
return countChars(node) - spaces;
|
|
32
32
|
};
|
|
33
33
|
export const countChars = node => {
|
|
34
|
-
const textContent =
|
|
34
|
+
const textContent = node?.innerText || '';
|
|
35
35
|
const iterator = textContent[Symbol.iterator]();
|
|
36
36
|
let count = 0;
|
|
37
37
|
while (!iterator.next().done) {
|
|
@@ -30,12 +30,9 @@ export const HEADERS = [{
|
|
|
30
30
|
}];
|
|
31
31
|
const ROW_LABELS = [['words', () => formatMessage('Words')], ['chars-no-spaces', () => formatMessage('Characters (no spaces)')], ['chars', () => formatMessage('Characters')]];
|
|
32
32
|
export const generateRows = ed => {
|
|
33
|
-
return ROW_LABELS.map(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
selectionCount: countContent(ed, 'selection', category)
|
|
39
|
-
};
|
|
40
|
-
});
|
|
33
|
+
return ROW_LABELS.map(([category, getLabel]) => ({
|
|
34
|
+
label: getLabel(),
|
|
35
|
+
documentCount: countContent(ed, 'body', category),
|
|
36
|
+
selectionCount: countContent(ed, 'selection', category)
|
|
37
|
+
}));
|
|
41
38
|
};
|
|
@@ -163,13 +163,12 @@ export default function CanvasContentTray(props) {
|
|
|
163
163
|
}
|
|
164
164
|
}, [hasOpened]);
|
|
165
165
|
useEffect(() => {
|
|
166
|
-
var _trayRef$current;
|
|
167
166
|
if (!hasOpened) return;
|
|
168
167
|
let c = document.querySelector('[role="main"]');
|
|
169
168
|
let target_w = 0;
|
|
170
169
|
if (!c) return;
|
|
171
170
|
const margin = window.getComputedStyle(c).direction === 'ltr' ? document.body.getBoundingClientRect().right - c.getBoundingClientRect().right : c.getBoundingClientRect().left;
|
|
172
|
-
target_w = c.offsetWidth -
|
|
171
|
+
target_w = c.offsetWidth - trayRef.current?.offsetWidth + margin;
|
|
173
172
|
if (target_w >= 320 && target_w < c.offsetWidth) {
|
|
174
173
|
c.style.boxSizing = 'border-box';
|
|
175
174
|
c.style.width = `${target_w}px`;
|
|
@@ -271,11 +270,11 @@ export default function CanvasContentTray(props) {
|
|
|
271
270
|
function renderLinkDisplay() {
|
|
272
271
|
return isEditTray && /*#__PURE__*/React.createElement(LinkDisplay, {
|
|
273
272
|
linkText: linkText,
|
|
274
|
-
placeholderText:
|
|
275
|
-
linkFileName:
|
|
276
|
-
published:
|
|
273
|
+
placeholderText: link?.title || placeholderText,
|
|
274
|
+
linkFileName: link?.title || '',
|
|
275
|
+
published: link?.published || false,
|
|
277
276
|
handleTextChange: setLinkText,
|
|
278
|
-
linkType: link
|
|
277
|
+
linkType: link?.type
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
280
|
return /*#__PURE__*/React.createElement(Tray, {
|
|
@@ -356,11 +355,6 @@ export default function CanvasContentTray(props) {
|
|
|
356
355
|
}, storeProps)))), isEditTray && renderFooter())) : null));
|
|
357
356
|
}
|
|
358
357
|
CanvasContentTray.globalOpenCount = 0;
|
|
359
|
-
function requiredWithoutSource(props, propName, componentName) {
|
|
360
|
-
if (props.source == null && props[propName] == null) {
|
|
361
|
-
throw new Error(`The prop \`${propName}\` is marked as required in \`${componentName}\`, but its value is \`${props[propName]}\`.`);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
358
|
|
|
365
359
|
// Changes made here may need to be reflected in the trayProps type in CanvasContentPanel
|
|
366
360
|
const trayPropsMap = {
|
|
@@ -375,8 +369,8 @@ const trayPropsMap = {
|
|
|
375
369
|
userId: string.isRequired
|
|
376
370
|
}),
|
|
377
371
|
filesTabDisabled: bool,
|
|
378
|
-
host:
|
|
379
|
-
jwt:
|
|
372
|
+
host: string,
|
|
373
|
+
jwt: string,
|
|
380
374
|
refreshToken: func,
|
|
381
375
|
source: shape({
|
|
382
376
|
fetchImages: func.isRequired
|
|
@@ -397,12 +391,11 @@ CanvasContentTray.propTypes = {
|
|
|
397
391
|
};
|
|
398
392
|
|
|
399
393
|
// the way we define trayProps, eslint doesn't recognize the following as props
|
|
400
|
-
|
|
394
|
+
|
|
401
395
|
CanvasContentTray.defaultProps = {
|
|
402
396
|
canUploadFiles: false,
|
|
403
397
|
filesTabDisabled: false,
|
|
404
398
|
refreshToken: null,
|
|
405
399
|
source: null,
|
|
406
400
|
themeUrl: null
|
|
407
|
-
};
|
|
408
|
-
/* eslint-enable react/default-props-match-prop-types */
|
|
401
|
+
};
|