@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
|
@@ -39,18 +39,17 @@ const msgid = () => uid('msg', 3);
|
|
|
39
39
|
const modifyAllTaskMessage = formatMessage('Hello. Please describe the modifications you would like to make to your composition.');
|
|
40
40
|
const modifySelectionTaskMessage = formatMessage('Hello. Please describe the modifications you would like to make to your selection.');
|
|
41
41
|
const generateTaskMessage = formatMessage('Please decribe what you would like to compose.');
|
|
42
|
-
export const AIToolsTray =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = _ref;
|
|
42
|
+
export const AIToolsTray = ({
|
|
43
|
+
open,
|
|
44
|
+
container,
|
|
45
|
+
mountNode,
|
|
46
|
+
contextId,
|
|
47
|
+
contextType,
|
|
48
|
+
currentContent,
|
|
49
|
+
onClose,
|
|
50
|
+
onInsertContent,
|
|
51
|
+
onReplaceContent
|
|
52
|
+
}) => {
|
|
54
53
|
const [trayRef, setTrayRef] = useState(null);
|
|
55
54
|
const [containerStyle] = useState(() => {
|
|
56
55
|
if (container) {
|
|
@@ -91,9 +90,8 @@ export const AIToolsTray = _ref => {
|
|
|
91
90
|
setUserPrompt('');
|
|
92
91
|
}, [initChatMessages]);
|
|
93
92
|
useLayoutEffect(() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
lastbox === null || lastbox === void 0 ? void 0 : lastbox.scrollIntoView({
|
|
93
|
+
const lastbox = chatContainerRef.current?.querySelector('.ai-chat-box:last-child');
|
|
94
|
+
lastbox?.scrollIntoView({
|
|
97
95
|
behavior: 'smooth',
|
|
98
96
|
block: 'nearest'
|
|
99
97
|
});
|
|
@@ -133,7 +131,7 @@ export const AIToolsTray = _ref => {
|
|
|
133
131
|
setWaitingForResponse(true);
|
|
134
132
|
|
|
135
133
|
// the .finally triggered the error even though there is a .catch
|
|
136
|
-
|
|
134
|
+
|
|
137
135
|
doFetchApi({
|
|
138
136
|
path: '/api/v1/rich_content/generate',
|
|
139
137
|
method: 'POST',
|
|
@@ -241,7 +239,6 @@ export const AIToolsTray = _ref => {
|
|
|
241
239
|
getResponse(userPrompt);
|
|
242
240
|
}, [getResponse, userPrompt]);
|
|
243
241
|
const handleDislikeResponse = useCallback(() => {
|
|
244
|
-
// eslint-disable-next-line no-console
|
|
245
242
|
console.log('dislike response'); // TODO: what?
|
|
246
243
|
}, []);
|
|
247
244
|
const handleShowWholeResponse = useCallback(event => {
|
|
@@ -38,8 +38,8 @@ const InsertSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18
|
|
|
38
38
|
<path d="M3.59082 14.4093H14.4099V3.59058H3.59082V14.4093ZM4.64532 4.64508H13.3551V13.3548H4.64532V4.64508Z" fill="#2D3B45"/>
|
|
39
39
|
<path d="M9.52752 6.92065H8.47302V8.47278H6.9209V9.52728H8.47302V11.0794H9.52752V9.52728H11.0796V8.47278H9.52752V6.92065Z" fill="#2D3B45"/>
|
|
40
40
|
</svg>`;
|
|
41
|
-
const CopySVG = IconCopyLine
|
|
42
|
-
const RefreshSVG = IconRefreshLine
|
|
41
|
+
const CopySVG = IconCopyLine?.src;
|
|
42
|
+
const RefreshSVG = IconRefreshLine?.src;
|
|
43
43
|
const DislikeSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
44
44
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.17647 7.41176L3.2353 7.41176L3.2353 6.35294C2.65189 6.35294 2.17647 5.87859 2.17647 5.29411C2.17647 4.70964 2.65189 4.23529 3.2353 4.23529L4.29412 4.23529L4.29412 3.17647C3.71071 3.17647 3.2353 2.70211 3.2353 2.11764C3.2353 1.53317 3.71071 1.05882 4.29412 1.05882L13.2941 1.05882C14.7532 1.05882 15.9412 2.24576 15.9412 3.70588L15.9412 9.52941L14.9417 9.52941C13.6277 9.52941 12.3698 10.0694 11.4888 11.0086C10.2267 12.3554 8.738 14.4445 8.54953 16.9412L8.20859 16.9412C7.7353 16.9412 7.28953 16.7315 6.98671 16.3652C6.68071 15.9946 6.55683 15.5107 6.64788 15.0385C6.86071 13.9267 7.21224 12.8255 7.69083 11.7656C7.91424 11.2733 7.87188 10.71 7.58071 10.2568C7.28635 9.80153 6.78659 9.52941 6.24341 9.52941L2.17647 9.52941C1.59306 9.52941 1.11765 9.05506 1.11765 8.47059C1.11765 7.88611 1.59306 7.41176 2.17647 7.41176ZM0.0588235 8.47059C0.0588234 9.63847 1.00859 10.5882 2.17647 10.5882L6.24341 10.5882C6.42765 10.5882 6.59071 10.6761 6.69024 10.8307C6.78765 10.9821 6.80141 11.1642 6.72624 11.3294C6.21377 12.4645 5.83682 13.6461 5.60706 14.8405C5.45776 15.624 5.66212 16.4255 6.17035 17.0396C6.67541 17.6495 7.41871 18 8.20859 18L9.58824 18L9.58824 17.4706C9.58824 15.0851 11.042 13.0341 12.2607 11.7328C12.9426 11.0065 13.9199 10.5882 14.9416 10.5882L17 10.5882L17 3.70588C17 1.66235 15.3376 -1.45327e-07 13.2941 -3.23979e-07L4.29412 -1.11078e-06C3.12624 -1.21288e-06 2.17647 0.949763 2.17647 2.11765C2.17647 2.55282 2.30882 2.95835 2.53435 3.29506C1.71059 3.58518 1.11765 4.37188 1.11765 5.29412C1.11765 5.72929 1.25 6.13482 1.47553 6.47153C0.651767 6.76164 0.0588235 7.54835 0.0588235 8.47059Z" fill="#2D3B45"/>
|
|
45
45
|
</svg>`;
|
|
@@ -163,8 +163,7 @@ export const FILTER_SETTINGS_BY_PLUGIN = {
|
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
export function isLoading(sprops) {
|
|
166
|
-
|
|
167
|
-
return ((_sprops$collections$a = sprops.collections.announcements) === null || _sprops$collections$a === void 0 ? void 0 : _sprops$collections$a.isLoading) || ((_sprops$collections$a2 = sprops.collections.assignments) === null || _sprops$collections$a2 === void 0 ? void 0 : _sprops$collections$a2.isLoading) || ((_sprops$collections$d = sprops.collections.discussions) === null || _sprops$collections$d === void 0 ? void 0 : _sprops$collections$d.isLoading) || ((_sprops$collections$m = sprops.collections.modules) === null || _sprops$collections$m === void 0 ? void 0 : _sprops$collections$m.isLoading) || ((_sprops$collections$q = sprops.collections.quizzes) === null || _sprops$collections$q === void 0 ? void 0 : _sprops$collections$q.isLoading) || ((_sprops$collections$w = sprops.collections.wikiPages) === null || _sprops$collections$w === void 0 ? void 0 : _sprops$collections$w.isLoading) || ((_sprops$documents$cou = sprops.documents.course) === null || _sprops$documents$cou === void 0 ? void 0 : _sprops$documents$cou.isLoading) || ((_sprops$documents$use = sprops.documents.user) === null || _sprops$documents$use === void 0 ? void 0 : _sprops$documents$use.isLoading) || ((_sprops$documents$gro = sprops.documents.group) === null || _sprops$documents$gro === void 0 ? void 0 : _sprops$documents$gro.isLoading) || ((_sprops$media$course = sprops.media.course) === null || _sprops$media$course === void 0 ? void 0 : _sprops$media$course.isLoading) || ((_sprops$media$user = sprops.media.user) === null || _sprops$media$user === void 0 ? void 0 : _sprops$media$user.isLoading) || ((_sprops$media$group = sprops.media.group) === null || _sprops$media$group === void 0 ? void 0 : _sprops$media$group.isLoading) || ((_sprops$all_files = sprops.all_files) === null || _sprops$all_files === void 0 ? void 0 : _sprops$all_files.isLoading);
|
|
166
|
+
return sprops.collections.announcements?.isLoading || sprops.collections.assignments?.isLoading || sprops.collections.discussions?.isLoading || sprops.collections.modules?.isLoading || sprops.collections.quizzes?.isLoading || sprops.collections.wikiPages?.isLoading || sprops.documents.course?.isLoading || sprops.documents.user?.isLoading || sprops.documents.group?.isLoading || sprops.media.course?.isLoading || sprops.media.user?.isLoading || sprops.media.group?.isLoading || sprops.all_files?.isLoading;
|
|
168
167
|
}
|
|
169
168
|
function renderLoading() {
|
|
170
169
|
return formatMessage('Loading');
|
|
@@ -25,15 +25,14 @@ function blobToBase64(blob) {
|
|
|
25
25
|
reader.readAsDataURL(blob);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function drawImageOnCanvasElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref;
|
|
28
|
+
function drawImageOnCanvasElement({
|
|
29
|
+
image,
|
|
30
|
+
quality,
|
|
31
|
+
previewWidth,
|
|
32
|
+
previewHeight,
|
|
33
|
+
resolve,
|
|
34
|
+
reject
|
|
35
|
+
}) {
|
|
37
36
|
const {
|
|
38
37
|
width,
|
|
39
38
|
height
|
|
@@ -61,19 +60,17 @@ export function canCompressImage() {
|
|
|
61
60
|
// Some old browsers don't support toBlob
|
|
62
61
|
return Boolean(document.createElement('canvas').toBlob);
|
|
63
62
|
}
|
|
64
|
-
export function shouldCompressImage(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} = _ref2;
|
|
63
|
+
export function shouldCompressImage({
|
|
64
|
+
type,
|
|
65
|
+
size
|
|
66
|
+
}) {
|
|
69
67
|
return ['image/jpeg', 'image/webp', 'image/bmp', 'image/tiff'].includes(type) && size > MAX_IMAGE_SIZE_BYTES;
|
|
70
68
|
}
|
|
71
|
-
export function compressImage(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} = _ref3;
|
|
69
|
+
export function compressImage({
|
|
70
|
+
encodedImage,
|
|
71
|
+
previewWidth,
|
|
72
|
+
previewHeight
|
|
73
|
+
}) {
|
|
77
74
|
return new Promise((resolve, reject) => {
|
|
78
75
|
const image = new Image();
|
|
79
76
|
image.src = encodedImage;
|
|
@@ -20,11 +20,10 @@
|
|
|
20
20
|
import parseLinkHeader from './parse-link-header';
|
|
21
21
|
import { defaultFetchOptions } from './defaultFetchOptions';
|
|
22
22
|
import { toQueryString } from './query-string-encoding';
|
|
23
|
-
function constructRelativeUrl(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
23
|
+
function constructRelativeUrl({
|
|
24
|
+
path,
|
|
25
|
+
params
|
|
26
|
+
}) {
|
|
28
27
|
const queryString = toQueryString(params);
|
|
29
28
|
if (queryString.length === 0) return path;
|
|
30
29
|
return path + '?' + queryString;
|
|
@@ -34,15 +33,14 @@ function constructRelativeUrl(_ref) {
|
|
|
34
33
|
|
|
35
34
|
// NOTE: we do NOT deep-merge customFetchOptions.headers, they should be passed
|
|
36
35
|
// in the headers arg instead.
|
|
37
|
-
export default async function doFetchApi(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref2;
|
|
36
|
+
export default async function doFetchApi({
|
|
37
|
+
path,
|
|
38
|
+
method = 'GET',
|
|
39
|
+
headers = {},
|
|
40
|
+
params = {},
|
|
41
|
+
body,
|
|
42
|
+
fetchOpts = {}
|
|
43
|
+
}) {
|
|
46
44
|
const finalFetchOptions = {
|
|
47
45
|
...defaultFetchOptions()
|
|
48
46
|
};
|
|
@@ -60,7 +58,6 @@ export default async function doFetchApi(_ref2) {
|
|
|
60
58
|
body,
|
|
61
59
|
method,
|
|
62
60
|
...finalFetchOptions,
|
|
63
|
-
// eslint-disable-next-line no-undef
|
|
64
61
|
credentials: finalFetchOptions.credentials
|
|
65
62
|
});
|
|
66
63
|
if (!response.ok) {
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
*/
|
|
25
25
|
export default function getCookie(cookieName) {
|
|
26
26
|
const match = document.cookie.match('(^|[^;]+)\\s*' + cookieName + '\\s*=\\s*([^;]+)');
|
|
27
|
-
const first = match
|
|
27
|
+
const first = match?.pop();
|
|
28
28
|
return first ? decodeURIComponent(first) : undefined;
|
|
29
29
|
}
|
|
@@ -78,18 +78,16 @@ export function getIWorkType(filename) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
81
|
-
var _RCEGlobals$getFeatur;
|
|
82
81
|
// why oh why aren't we consistent?
|
|
83
82
|
const content_type = file['content-type'] || file.content_type || file.type;
|
|
84
83
|
if (typeof content_type !== 'string') throw new Error('Invalid content type');
|
|
85
84
|
const type = content_type.replace(/\/.*$/, '');
|
|
86
85
|
const baseOrigin = canvasOrigin !== null && canvasOrigin !== void 0 ? canvasOrigin : window.location.origin;
|
|
87
|
-
if (
|
|
88
|
-
var _RCEGlobals$getFeatur2;
|
|
86
|
+
if (RCEGlobals.getFeatures()?.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
89
87
|
const url = new URL(`/media_attachments_iframe/${file.id}`, baseOrigin);
|
|
90
88
|
url.searchParams.set('type', type);
|
|
91
89
|
url.searchParams.set('embedded', 'true');
|
|
92
|
-
if (file.uuid && (file.contextType === 'User' || canvasOrigin && canvasOrigin !== window.location.origin &&
|
|
90
|
+
if (file.uuid && (file.contextType === 'User' || canvasOrigin && canvasOrigin !== window.location.origin && RCEGlobals.getFeatures()?.file_verifiers_for_quiz_links)) {
|
|
93
91
|
url.searchParams.set('verifier', file.uuid);
|
|
94
92
|
} else if (file.url || file.href) {
|
|
95
93
|
const href = file.url || file.href;
|
|
@@ -113,8 +111,7 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
113
111
|
return `${relative}?type=${type}`;
|
|
114
112
|
}
|
|
115
113
|
if (isAudioOrVideo(content_type)) {
|
|
116
|
-
|
|
117
|
-
const mediaEntryId = file.media_entry_id || ((_file$embed = file.embed) === null || _file$embed === void 0 ? void 0 : _file$embed.id) || file.mediaEntryId;
|
|
114
|
+
const mediaEntryId = file.media_entry_id || file.embed?.id || file.mediaEntryId;
|
|
118
115
|
if (mediaEntryId && mediaEntryId !== 'maybe') {
|
|
119
116
|
return `/media_objects_iframe/${mediaEntryId}?type=${type}`;
|
|
120
117
|
}
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
export default function round(number) {
|
|
20
|
-
let decimalDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
19
|
+
export default function round(number, decimalDigits = 2) {
|
|
21
20
|
if (decimalDigits < 0) throw new Error('decimal digits must be >= 0');
|
|
22
21
|
if (decimalDigits % 1 !== 0) throw new Error('decimal digits must be a whole number');
|
|
23
22
|
const val = Math.round(number * 10 ** decimalDigits) / 10 ** decimalDigits;
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
const MASQUERADE_SELECTOR = 'body.is-masquerading-or-student-view';
|
|
20
20
|
let trayHeight = null;
|
|
21
|
+
export const resetTrayHeight = () => {
|
|
22
|
+
trayHeight = null;
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
// Adjusts the height that slide-out trays should take up based on the presence
|
|
23
26
|
// or absence of the masquerade bottom bar. Caches the result of this check
|
|
@@ -53,11 +53,10 @@ const useDataUrl = () => {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (url) {
|
|
56
|
-
fetchDataUrl().then(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} = _ref;
|
|
56
|
+
fetchDataUrl().then(({
|
|
57
|
+
result,
|
|
58
|
+
blob
|
|
59
|
+
}) => {
|
|
61
60
|
setDataUrl(result);
|
|
62
61
|
setDataBlob(blob);
|
|
63
62
|
}).catch(e => {
|
|
@@ -25,8 +25,8 @@ import { View } from '@instructure/ui-view';
|
|
|
25
25
|
import ColorPicker from './color-picker';
|
|
26
26
|
import { stringifyRGBA, restrictColorValues, parseRGBA } from '../utils/colors';
|
|
27
27
|
export default class ColorField extends React.Component {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(...
|
|
28
|
+
constructor(...args) {
|
|
29
|
+
super(...args);
|
|
30
30
|
this.state = {
|
|
31
31
|
textValue: this.props.value
|
|
32
32
|
};
|
|
@@ -44,14 +44,14 @@ import checkNode from '../node-checker';
|
|
|
44
44
|
import formatMessage from '../../../../format-message';
|
|
45
45
|
import { clearIndicators } from '../utils/indicate';
|
|
46
46
|
import { getTrayHeight } from '../../shared/trayUtils';
|
|
47
|
-
import {
|
|
47
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
48
48
|
|
|
49
49
|
// safari still doesn't support the standard api
|
|
50
50
|
const FS_CHANGEEVENT = document.exitFullscreen ? 'fullscreenchange' : 'webkitfullscreenchange';
|
|
51
51
|
const noop = () => {};
|
|
52
52
|
export default class Checker extends React.Component {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...
|
|
53
|
+
constructor(...args) {
|
|
54
|
+
super(...args);
|
|
55
55
|
this.state = {
|
|
56
56
|
open: false,
|
|
57
57
|
checking: false,
|
|
@@ -65,10 +65,9 @@ export default class Checker extends React.Component {
|
|
|
65
65
|
this.onFullscreenChange = _event => {
|
|
66
66
|
this.selectCurrent();
|
|
67
67
|
};
|
|
68
|
-
this.updateFormState =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} = _ref;
|
|
68
|
+
this.updateFormState = ({
|
|
69
|
+
target
|
|
70
|
+
}) => {
|
|
72
71
|
this.setState(prevState => {
|
|
73
72
|
const formState = {
|
|
74
73
|
...prevState.formState
|
|
@@ -255,8 +254,7 @@ export default class Checker extends React.Component {
|
|
|
255
254
|
this._tempTestNode = dom.nodeByPath(newTempRootNode, path);
|
|
256
255
|
return newTempRootNode;
|
|
257
256
|
}
|
|
258
|
-
tempNode() {
|
|
259
|
-
let refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
257
|
+
tempNode(refresh = false) {
|
|
260
258
|
if (!this._tempNode || refresh) {
|
|
261
259
|
const rootNode = this.errorRootNode();
|
|
262
260
|
if (rootNode) {
|
|
@@ -437,7 +435,7 @@ export default class Checker extends React.Component {
|
|
|
437
435
|
switch (true) {
|
|
438
436
|
case !!f.options:
|
|
439
437
|
return /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
440
|
-
mountNode:
|
|
438
|
+
mountNode: instuiPopupMountNodeFn(),
|
|
441
439
|
disabled: disabled,
|
|
442
440
|
onChange: (e, option) => {
|
|
443
441
|
this.updateFormState({
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import * as dom from './utils/dom';
|
|
20
20
|
import rules from './rules';
|
|
21
|
-
export default function checkNode(node, done) {
|
|
22
|
-
let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
23
|
-
let additionalRules = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
21
|
+
export default function checkNode(node, done, config = {}, additionalRules = []) {
|
|
24
22
|
if (!node) {
|
|
25
23
|
return;
|
|
26
24
|
}
|
|
@@ -29,15 +29,14 @@ container.className = 'tinymce-a11y-checker-container';
|
|
|
29
29
|
document.body.appendChild(container);
|
|
30
30
|
tinymce.create('tinymce.plugins.AccessibilityChecker', {
|
|
31
31
|
init(ed) {
|
|
32
|
-
ed.addCommand('openAccessibilityChecker', function (ui,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
32
|
+
ed.addCommand('openAccessibilityChecker', function (ui, {
|
|
33
|
+
done,
|
|
34
|
+
config,
|
|
35
|
+
additionalRules,
|
|
36
|
+
mountNode,
|
|
37
|
+
triggerElementId,
|
|
38
|
+
onFixError
|
|
39
|
+
}) {
|
|
41
40
|
if (!isCheckerOpen) {
|
|
42
41
|
ReactDOM.render(/*#__PURE__*/React.createElement(Checker, {
|
|
43
42
|
getBody: ed.getBody.bind(ed),
|
|
@@ -47,9 +46,8 @@ tinymce.create('tinymce.plugins.AccessibilityChecker', {
|
|
|
47
46
|
onClose: () => {
|
|
48
47
|
isCheckerOpen = false;
|
|
49
48
|
if (triggerElementId) {
|
|
50
|
-
var _button$;
|
|
51
49
|
const button = document.querySelectorAll(`[data-btn-id=${triggerElementId}]`);
|
|
52
|
-
|
|
50
|
+
button[0]?.focus();
|
|
53
51
|
}
|
|
54
52
|
},
|
|
55
53
|
onFixError: onFixError
|
|
@@ -66,12 +64,11 @@ tinymce.create('tinymce.plugins.AccessibilityChecker', {
|
|
|
66
64
|
isCheckerOpen = true;
|
|
67
65
|
}
|
|
68
66
|
});
|
|
69
|
-
ed.addCommand('checkAccessibility', function (ui,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref2;
|
|
67
|
+
ed.addCommand('checkAccessibility', function (ui, {
|
|
68
|
+
done,
|
|
69
|
+
config,
|
|
70
|
+
additionalRules
|
|
71
|
+
}) {
|
|
75
72
|
checkNode(ed.getBody(), done, config, additionalRules);
|
|
76
73
|
});
|
|
77
74
|
ed.ui.registry.addButton('check_a11y', {
|
|
@@ -20,8 +20,7 @@ import { changeTag } from '../utils/dom';
|
|
|
20
20
|
import formatMessage from '../../../../format-message';
|
|
21
21
|
export default {
|
|
22
22
|
id: 'headings-start-at-h2',
|
|
23
|
-
test:
|
|
24
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
|
+
test: (elem, config = {}) => {
|
|
25
24
|
if (config.disableHeadingsStartAtH2) {
|
|
26
25
|
return true;
|
|
27
26
|
}
|
|
@@ -22,8 +22,7 @@ import smallTextContrast from './small-text-contrast';
|
|
|
22
22
|
import { onlyContainsLink, hasTextNode } from '../utils/dom';
|
|
23
23
|
export default {
|
|
24
24
|
id: 'large-text-contrast',
|
|
25
|
-
test:
|
|
26
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
|
+
test: (elem, config = {}) => {
|
|
27
26
|
const disabled = config.disableContrastCheck == true;
|
|
28
27
|
const noText = !hasTextNode(elem);
|
|
29
28
|
if (disabled || noText || onlyContainsLink(elem) || !contrast.isLargeText(elem)) {
|
|
@@ -24,8 +24,7 @@ import { stringifyRGBA } from '../utils/colors';
|
|
|
24
24
|
import uid from '@instructure/uid';
|
|
25
25
|
export default {
|
|
26
26
|
id: 'small-text-contrast',
|
|
27
|
-
test:
|
|
28
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
test: (elem, config = {}) => {
|
|
29
28
|
const disabled = config.disableContrastCheck == true;
|
|
30
29
|
const noText = !hasTextNode(elem);
|
|
31
30
|
if (disabled || noText || onlyContainsLink(elem) || contrast.isLargeText(elem)) {
|
|
@@ -48,14 +48,12 @@ export function walk(node, fn, done) {
|
|
|
48
48
|
};
|
|
49
49
|
processBatch();
|
|
50
50
|
}
|
|
51
|
-
export function select(elem) {
|
|
52
|
-
var _elem$ownerDocument;
|
|
53
|
-
let indicateFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : indicate;
|
|
51
|
+
export function select(elem, indicateFn = indicate) {
|
|
54
52
|
if (elem == null) {
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
57
55
|
elem.scrollIntoView(false);
|
|
58
|
-
if (
|
|
56
|
+
if (elem.ownerDocument?.documentElement) {
|
|
59
57
|
elem.ownerDocument.documentElement.scrollTop += 5; // room for the indicator highlight
|
|
60
58
|
}
|
|
61
59
|
indicateFn(elem);
|
|
@@ -31,7 +31,7 @@ export const A11Y_CHECKER_STYLE_ELEM_ID = 'a11y-checker-style';
|
|
|
31
31
|
// Remove the current indicator(s) by removing the contents of
|
|
32
32
|
// the style element
|
|
33
33
|
export function clearIndicators(doc) {
|
|
34
|
-
const checker_style = doc
|
|
34
|
+
const checker_style = doc?.getElementById(A11Y_CHECKER_STYLE_ELEM_ID);
|
|
35
35
|
if (checker_style) {
|
|
36
36
|
checker_style.textContent = '';
|
|
37
37
|
}
|
|
@@ -46,11 +46,10 @@ export function buildDepthSelector(elem) {
|
|
|
46
46
|
let target = elem;
|
|
47
47
|
let parent = target.parentElement;
|
|
48
48
|
while (target && parent && target !== elemBody) {
|
|
49
|
-
var _target;
|
|
50
49
|
const depth = findChildDepth(parent, target);
|
|
51
50
|
depths.unshift(`>:nth-child(${depth})`);
|
|
52
51
|
target = parent;
|
|
53
|
-
parent =
|
|
52
|
+
parent = target?.parentElement;
|
|
54
53
|
}
|
|
55
54
|
return `body${depths.join('')}`;
|
|
56
55
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* This file is taken from the rgb-hex npm module to ensure it is transpiled.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export default (red, green, blue, alpha) => {
|
|
24
24
|
const isPercent = (red + (alpha || '')).toString().includes('%');
|
|
25
25
|
if (typeof red === 'string') {
|
|
26
26
|
const res = red.match(/(0?\.?\d{1,3})%?\b/g).map(Number);
|
|
@@ -43,12 +43,9 @@ module.exports = (red, green, blue, alpha) => {
|
|
|
43
43
|
} else {
|
|
44
44
|
throw new TypeError(`Expected alpha value (${alpha}) as a fraction or percentage`);
|
|
45
45
|
}
|
|
46
|
-
// eslint-disable-next-line no-bitwise
|
|
47
46
|
alpha = (alpha | 1 << 8).toString(16).slice(1);
|
|
48
47
|
} else {
|
|
49
48
|
alpha = '';
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
// eslint-disable-next-line no-bitwise
|
|
53
50
|
return (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1) + alpha;
|
|
54
51
|
};
|
package/es/rce/root.js
CHANGED
|
@@ -21,34 +21,34 @@ import { render, unmountComponentAtNode } from 'react-dom';
|
|
|
21
21
|
import RCEWrapper from './RCEWrapper';
|
|
22
22
|
import normalizeProps from './normalizeProps';
|
|
23
23
|
import formatMessage from '../format-message';
|
|
24
|
-
|
|
24
|
+
import generateId from 'format-message-generate-id/underscored_crc32';
|
|
25
|
+
if (!undefined) {
|
|
25
26
|
formatMessage.setup({
|
|
26
27
|
locale: 'en',
|
|
27
|
-
generateId
|
|
28
|
+
generateId,
|
|
28
29
|
missingTranslation: 'ignore'
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
export function renderIntoDiv(target, props, renderCallback) {
|
|
32
33
|
import('./tinyRCE').then(module => {
|
|
33
34
|
const tinyRCE = module.default;
|
|
34
|
-
|
|
35
|
-
// normalize props
|
|
36
|
-
props = normalizeProps(props, tinyRCE);
|
|
35
|
+
const normalizedProps = normalizeProps(props, tinyRCE);
|
|
37
36
|
formatMessage.setup({
|
|
38
|
-
locale:
|
|
37
|
+
locale: normalizedProps.language
|
|
39
38
|
});
|
|
40
39
|
// render the editor to the target element
|
|
41
40
|
const renderedComponent = /*#__PURE__*/createRef();
|
|
42
41
|
render(/*#__PURE__*/React.createElement(RCEWrapper, Object.assign({
|
|
43
42
|
ref: renderedComponent
|
|
44
|
-
},
|
|
43
|
+
}, normalizedProps, {
|
|
45
44
|
handleUnmount: () => unmountComponentAtNode(target)
|
|
46
45
|
})), target, () => {
|
|
47
46
|
// pass it back
|
|
48
|
-
renderCallback &&
|
|
47
|
+
if (renderCallback && renderedComponent.current) {
|
|
48
|
+
renderCallback(renderedComponent.current);
|
|
49
|
+
}
|
|
49
50
|
});
|
|
50
51
|
}).catch(err => {
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
52
|
console.error('Failed loading RCE', err);
|
|
53
53
|
});
|
|
54
54
|
}
|
package/es/rce/tinyRCE.js
CHANGED
|
@@ -63,7 +63,7 @@ export function transformRceContentForEditing(inputHtml, options) {
|
|
|
63
63
|
// fixup LTI iframe launches to use the `in_rce` display type
|
|
64
64
|
container.querySelectorAll('iframe[src]').forEach(element => {
|
|
65
65
|
const src = element.getAttribute('src');
|
|
66
|
-
if (src
|
|
66
|
+
if (src?.includes('display=borderless')) {
|
|
67
67
|
element.setAttribute('src', src.replace('display=borderless', 'display=in_rce'));
|
|
68
68
|
}
|
|
69
69
|
});
|