@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
|
@@ -54,9 +54,8 @@ export default function Link(props) {
|
|
|
54
54
|
if (date === 'multiple') {
|
|
55
55
|
dateString = formatMessage('Due: Multiple Dates');
|
|
56
56
|
} else {
|
|
57
|
-
var _RCEGlobals$getConfig;
|
|
58
57
|
// Uses user locale and timezone
|
|
59
|
-
const configuredTimezone =
|
|
58
|
+
const configuredTimezone = RCEGlobals.getConfig()?.timezone;
|
|
60
59
|
const when = formatMessage.date(applyTimezoneOffsetToDate(date, configuredTimezone), 'long');
|
|
61
60
|
switch (date_type) {
|
|
62
61
|
case 'todo':
|
|
@@ -125,69 +124,66 @@ export default function Link(props) {
|
|
|
125
124
|
style: {
|
|
126
125
|
position: 'relative'
|
|
127
126
|
}
|
|
128
|
-
}, /*#__PURE__*/React.createElement(Focusable, null,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
inline: false
|
|
189
|
-
})))))))));
|
|
190
|
-
}));
|
|
127
|
+
}, /*#__PURE__*/React.createElement(Focusable, null, ({
|
|
128
|
+
focused
|
|
129
|
+
}) => /*#__PURE__*/React.createElement(View, {
|
|
130
|
+
withFocusOutline: focused,
|
|
131
|
+
focusPosition: "inset",
|
|
132
|
+
position: "relative",
|
|
133
|
+
as: "div",
|
|
134
|
+
role: "button",
|
|
135
|
+
tabIndex: 0,
|
|
136
|
+
background: "primary",
|
|
137
|
+
display: "block",
|
|
138
|
+
width: "100%",
|
|
139
|
+
borderWidth: "0 0 small 0",
|
|
140
|
+
padding: "x-small",
|
|
141
|
+
"aria-describedby": props.describedByID,
|
|
142
|
+
onClick: handleLinkClick,
|
|
143
|
+
onKeyDown: handleLinkKey,
|
|
144
|
+
elementRef: props.elementRef
|
|
145
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
style: {
|
|
147
|
+
pointerEvents: 'none'
|
|
148
|
+
}
|
|
149
|
+
}, /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Flex.Item, {
|
|
150
|
+
margin: "0 xx-small 0 0",
|
|
151
|
+
size: "1.125rem"
|
|
152
|
+
}, isHovering && !props.editing ? /*#__PURE__*/React.createElement(IconDragHandleLine, {
|
|
153
|
+
size: "x-small",
|
|
154
|
+
inline: false
|
|
155
|
+
}) : null), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
156
|
+
shouldGrow: true,
|
|
157
|
+
shouldShrink: true
|
|
158
|
+
}, /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Flex.Item, {
|
|
159
|
+
padding: "0 x-small 0 0"
|
|
160
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
161
|
+
color: color
|
|
162
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
163
|
+
size: "x-small",
|
|
164
|
+
inline: false,
|
|
165
|
+
"data-type": type
|
|
166
|
+
}))), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
167
|
+
padding: "0 x-small 0 0",
|
|
168
|
+
shouldGrow: true,
|
|
169
|
+
shouldShrink: true,
|
|
170
|
+
textAlign: "start"
|
|
171
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
172
|
+
as: "div",
|
|
173
|
+
margin: "0"
|
|
174
|
+
}, title, props.isSelected && /*#__PURE__*/React.createElement(ScreenReaderContent, {
|
|
175
|
+
"data-testid": "selected-link-indicator"
|
|
176
|
+
}, formatMessage('Selected'))), dateString ? /*#__PURE__*/React.createElement(View, {
|
|
177
|
+
as: "div"
|
|
178
|
+
}, dateString) : null), 'published' in props.link && /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(AccessibleContent, {
|
|
179
|
+
alt: publishedMsg
|
|
180
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
181
|
+
color: color
|
|
182
|
+
}, published ? /*#__PURE__*/React.createElement(IconPublishSolid, {
|
|
183
|
+
inline: false
|
|
184
|
+
}) : /*#__PURE__*/React.createElement(IconUnpublishedSolid, {
|
|
185
|
+
inline: false
|
|
186
|
+
})))))))))));
|
|
191
187
|
}
|
|
192
188
|
Link.propTypes = {
|
|
193
189
|
link: linkShape.isRequired,
|
package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/LinkOptionsDialogController.js
CHANGED
|
@@ -68,14 +68,13 @@ export default class LinkOptionsDialogController {
|
|
|
68
68
|
_renderDialog() {
|
|
69
69
|
let html, onlyText, anchorElm, url, text;
|
|
70
70
|
if (this._shouldOpen) {
|
|
71
|
-
var _anchorElm;
|
|
72
71
|
html = this._editor.selection.getContent();
|
|
73
72
|
onlyText = isOnlyTextSelected(html);
|
|
74
73
|
text = onlyText && this._editor.selection.getContent({
|
|
75
74
|
format: 'text'
|
|
76
75
|
});
|
|
77
76
|
anchorElm = getAnchorElement(this._editor, this._editor.selection.getNode());
|
|
78
|
-
url =
|
|
77
|
+
url = anchorElm?.getAttribute('href');
|
|
79
78
|
|
|
80
79
|
/*
|
|
81
80
|
* When the dialog is being opened again, it should be rendered fresh
|
|
@@ -26,7 +26,7 @@ import { Modal } from '@instructure/ui-modal';
|
|
|
26
26
|
import { View } from '@instructure/ui-view';
|
|
27
27
|
import formatMessage from '../../../../../format-message';
|
|
28
28
|
import validateURL from '../../validateURL';
|
|
29
|
-
import {
|
|
29
|
+
import { instuiPopupMountNodeFn } from '../../../../../util/fullscreenHelpers';
|
|
30
30
|
const CREATE_LINK = 'create';
|
|
31
31
|
const EDIT_LINK = 'edit';
|
|
32
32
|
export default function LinkOptionsDialog(props) {
|
|
@@ -69,7 +69,7 @@ export default function LinkOptionsDialog(props) {
|
|
|
69
69
|
"data-mce-component": true,
|
|
70
70
|
as: "form",
|
|
71
71
|
label: label,
|
|
72
|
-
mountNode:
|
|
72
|
+
mountNode: instuiPopupMountNodeFn,
|
|
73
73
|
onDismiss: props.onRequestClose,
|
|
74
74
|
onEntered: props.onEntered,
|
|
75
75
|
onExited: props.onExited,
|
|
@@ -31,7 +31,7 @@ import validateURL from '../../validateURL';
|
|
|
31
31
|
import formatMessage from '../../../../../format-message';
|
|
32
32
|
import { DISPLAY_AS_LINK, DISPLAY_AS_EMBED, DISPLAY_AS_EMBED_DISABLED, DISPLAY_AS_DOWNLOAD_LINK } from '../../../shared/ContentSelection';
|
|
33
33
|
import { getTrayHeight } from '../../../shared/trayUtils';
|
|
34
|
-
import {
|
|
34
|
+
import { instuiPopupMountNodeFn } from '../../../../../util/fullscreenHelpers';
|
|
35
35
|
export default function LinkOptionsTray(props) {
|
|
36
36
|
const content = props.content || {};
|
|
37
37
|
const textToLink = content.text || '';
|
|
@@ -128,7 +128,7 @@ export default function LinkOptionsTray(props) {
|
|
|
128
128
|
"data-testid": "RCELinkOptionsTray",
|
|
129
129
|
"data-mce-component": true,
|
|
130
130
|
label: formatMessage('Link Options'),
|
|
131
|
-
mountNode:
|
|
131
|
+
mountNode: instuiPopupMountNodeFn,
|
|
132
132
|
onDismiss: props.onRequestClose,
|
|
133
133
|
onEntered: props.onEntered,
|
|
134
134
|
onExited: props.onExited,
|
|
@@ -85,9 +85,7 @@ class LinkSet extends Component {
|
|
|
85
85
|
isEmpty(props) {
|
|
86
86
|
return !this.hasLinks(props) && !props.collection.hasMore && !props.collection.isLoading;
|
|
87
87
|
}
|
|
88
|
-
compareURLs() {
|
|
89
|
-
let url1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
90
|
-
let url2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
88
|
+
compareURLs(url1 = '', url2 = '') {
|
|
91
89
|
if (url1 === '' || url2 === '') return false;
|
|
92
90
|
return url1.split('?')[0] === url2.split('?')[0];
|
|
93
91
|
}
|
|
@@ -108,31 +106,27 @@ class LinkSet extends Component {
|
|
|
108
106
|
isUnstyled: true,
|
|
109
107
|
as: "ul",
|
|
110
108
|
margin: "0"
|
|
111
|
-
}, this.props.collection.links.map((link, index, array) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
isSelected: this.compareURLs((_this$props$selectedL = this.props.selectedLink) === null || _this$props$selectedL === void 0 ? void 0 : _this$props$selectedL.href, link.href)
|
|
126
|
-
}));
|
|
127
|
-
})));
|
|
109
|
+
}, this.props.collection.links.map((link, index, array) => /*#__PURE__*/React.createElement(List.Item, {
|
|
110
|
+
key: link.href,
|
|
111
|
+
spacing: "none",
|
|
112
|
+
padding: "0"
|
|
113
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
114
|
+
link: link,
|
|
115
|
+
type: this.props.type,
|
|
116
|
+
onClick: this.props.onLinkClick,
|
|
117
|
+
describedByID: this.describedByID,
|
|
118
|
+
elementRef: refFor(index, array),
|
|
119
|
+
editing: this.props.editing,
|
|
120
|
+
onEditClick: this.props.onEditClick,
|
|
121
|
+
isSelected: this.compareURLs(this.props.selectedLink?.href, link.href)
|
|
122
|
+
})))));
|
|
128
123
|
}
|
|
129
124
|
renderEmptyIndicator() {
|
|
130
|
-
var _this$props$searchStr;
|
|
131
125
|
return /*#__PURE__*/React.createElement(NoResults, {
|
|
132
126
|
contextType: this.props.contextType,
|
|
133
127
|
contextId: this.props.contextId,
|
|
134
128
|
collectionType: this.props.type,
|
|
135
|
-
isSearchResult:
|
|
129
|
+
isSearchResult: this.props.searchString?.length >= 3
|
|
136
130
|
});
|
|
137
131
|
}
|
|
138
132
|
renderLoadingError() {
|
|
@@ -145,21 +139,18 @@ class LinkSet extends Component {
|
|
|
145
139
|
return null;
|
|
146
140
|
}
|
|
147
141
|
render() {
|
|
148
|
-
return /*#__PURE__*/React.createElement(IncrementalLoader, this.props,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
loader: loader
|
|
161
|
-
}));
|
|
162
|
-
});
|
|
142
|
+
return /*#__PURE__*/React.createElement(IncrementalLoader, this.props, ({
|
|
143
|
+
loader,
|
|
144
|
+
lastItemRef
|
|
145
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
"data-testid": "instructure_links-LinkSet"
|
|
147
|
+
}, this.hasLinks(this.props) && this.renderLinks(lastItemRef), this.renderLoadingError(), loader.isLoading && /*#__PURE__*/React.createElement(LoadingIndicator, {
|
|
148
|
+
loader: loader
|
|
149
|
+
}), !loader.isLoading && loader.hasMore && /*#__PURE__*/React.createElement(LoadMoreButton, {
|
|
150
|
+
loader: loader
|
|
151
|
+
}), this.isEmpty(this.props) && !this.props.suppressRenderEmpty && this.renderEmptyIndicator()), /*#__PURE__*/React.createElement(LoadingStatus, {
|
|
152
|
+
loader: loader
|
|
153
|
+
})));
|
|
163
154
|
}
|
|
164
155
|
}
|
|
165
156
|
LinkSet.propTypes = {
|
|
@@ -23,45 +23,58 @@ import { collectionsShape, linkShape } from './propTypes';
|
|
|
23
23
|
import NavigationPanel from './NavigationPanel';
|
|
24
24
|
import CollectionPanel from './CollectionPanel';
|
|
25
25
|
import { View } from '@instructure/ui-view';
|
|
26
|
-
import { pickProps } from '@instructure/ui-react-utils';
|
|
27
26
|
function LinksPanel(props) {
|
|
28
27
|
const isCourse = props.contextType === 'course';
|
|
29
28
|
const isGroup = props.contextType === 'group';
|
|
30
|
-
const
|
|
29
|
+
const commonCollectionProps = {
|
|
30
|
+
collections: props.collections,
|
|
31
|
+
contextId: props.contextId,
|
|
32
|
+
contextType: props.contextType,
|
|
33
|
+
fetchInitialPage: props.fetchInitialPage,
|
|
34
|
+
fetchNextPage: props.fetchNextPage,
|
|
35
|
+
newPageLinkExpanded: props.newPageLinkExpanded,
|
|
36
|
+
onChangeAccordion: props.onChangeAccordion,
|
|
37
|
+
onLinkClick: props.onLinkClick,
|
|
38
|
+
renderNewPageLink: props.renderNewPageLink,
|
|
39
|
+
searchString: props.searchString,
|
|
40
|
+
selectedAccordionIndex: props.selectedAccordionIndex,
|
|
41
|
+
suppressRenderEmpty: props.suppressRenderEmpty,
|
|
42
|
+
toggleNewPageForm: props.toggleNewPageForm
|
|
43
|
+
};
|
|
31
44
|
return /*#__PURE__*/React.createElement(View, {
|
|
32
45
|
as: "div",
|
|
33
46
|
"data-testid": "instructure_links-LinksPanel"
|
|
34
|
-
}, (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
47
|
+
}, (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
35
48
|
editing: props.editing,
|
|
36
49
|
onEditClick: props.onEditClick,
|
|
37
50
|
selectedLink: props.selectedLink,
|
|
38
51
|
collection: "wikiPages",
|
|
39
52
|
label: formatMessage('Pages')
|
|
40
|
-
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
53
|
+
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
41
54
|
editing: props.editing,
|
|
42
55
|
onEditClick: props.onEditClick,
|
|
43
56
|
selectedLink: props.selectedLink,
|
|
44
57
|
collection: "assignments",
|
|
45
58
|
label: formatMessage('Assignments')
|
|
46
|
-
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
59
|
+
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
47
60
|
editing: props.editing,
|
|
48
61
|
onEditClick: props.onEditClick,
|
|
49
62
|
selectedLink: props.selectedLink,
|
|
50
63
|
collection: "quizzes",
|
|
51
64
|
label: formatMessage('Quizzes')
|
|
52
|
-
})), (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
65
|
+
})), (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
53
66
|
editing: props.editing,
|
|
54
67
|
onEditClick: props.onEditClick,
|
|
55
68
|
selectedLink: props.selectedLink,
|
|
56
69
|
collection: "announcements",
|
|
57
70
|
label: formatMessage('Announcements')
|
|
58
|
-
})), (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
71
|
+
})), (isCourse || isGroup) && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
59
72
|
editing: props.editing,
|
|
60
73
|
onEditClick: props.onEditClick,
|
|
61
74
|
selectedLink: props.selectedLink,
|
|
62
75
|
collection: "discussions",
|
|
63
76
|
label: formatMessage('Discussions')
|
|
64
|
-
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({},
|
|
77
|
+
})), isCourse && /*#__PURE__*/React.createElement(CollectionPanel, Object.assign({}, commonCollectionProps, {
|
|
65
78
|
editing: props.editing,
|
|
66
79
|
onEditClick: props.onEditClick,
|
|
67
80
|
selectedLink: props.selectedLink,
|
|
@@ -48,13 +48,12 @@ export function getMessage(collectionType, isSearchResult) {
|
|
|
48
48
|
return isSearchResult ? formatMessage('No modules found.') : formatMessage('No modules created yet.');
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
export const NoResults =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref;
|
|
51
|
+
export const NoResults = ({
|
|
52
|
+
contextType,
|
|
53
|
+
contextId,
|
|
54
|
+
collectionType,
|
|
55
|
+
isSearchResult
|
|
56
|
+
}) => {
|
|
58
57
|
const Icon = getIcon(collectionType);
|
|
59
58
|
return /*#__PURE__*/React.createElement(View, {
|
|
60
59
|
padding: "xx-large"
|
|
@@ -79,8 +79,7 @@ function selectedAnchorCount(ed) {
|
|
|
79
79
|
return ed.selection.getRng().cloneContents().querySelectorAll('a').length;
|
|
80
80
|
}
|
|
81
81
|
function getMenuItems(ed) {
|
|
82
|
-
|
|
83
|
-
const contextType = (_ed$settings$canvas_r = ed.settings.canvas_rce_containing_context) === null || _ed$settings$canvas_r === void 0 ? void 0 : _ed$settings$canvas_r.type;
|
|
82
|
+
const contextType = ed.settings.canvas_rce_containing_context?.type;
|
|
84
83
|
const sel_anchors = ed.selection.isCollapsed() ? 0 : selectedAnchorCount(ed);
|
|
85
84
|
let items;
|
|
86
85
|
if (getAnchorElement(ed, ed.selection.getNode())) {
|
|
@@ -200,7 +199,7 @@ tinymce.PluginManager.add('instructure_links', function (ed) {
|
|
|
200
199
|
onSetup(api) {
|
|
201
200
|
// @ts-expect-error
|
|
202
201
|
function handleNodeChange(e) {
|
|
203
|
-
if (e
|
|
202
|
+
if (e?.element) {
|
|
204
203
|
api.setActive(!!getAnchorElement(ed, e.element));
|
|
205
204
|
}
|
|
206
205
|
if (ed.selection) {
|
|
@@ -215,23 +214,21 @@ tinymce.PluginManager.add('instructure_links', function (ed) {
|
|
|
215
214
|
if (ed.selection.getNode().tagName === 'A') {
|
|
216
215
|
node = ed.selection.getNode();
|
|
217
216
|
} else {
|
|
218
|
-
var _rng$endContainer$nex, _rng$nextSibling;
|
|
219
217
|
// Type checking is disabled here because the code below isn't type safe. The code below
|
|
220
218
|
// should be updated, specifically rng.endContainer.nextSibling?.tagName
|
|
221
219
|
const rng = ed.selection.getRng();
|
|
222
|
-
if (rng.commonAncestorContainer === rng.endContainer &&
|
|
220
|
+
if (rng.commonAncestorContainer === rng.endContainer && rng.endContainer.nextSibling?.tagName === 'A') {
|
|
223
221
|
node = rng.endContainer.nextSibling;
|
|
224
|
-
} else if (
|
|
222
|
+
} else if (rng.nextSibling?.tagName === 'A') {
|
|
225
223
|
node = rng.nextSibling;
|
|
226
224
|
}
|
|
227
225
|
}
|
|
228
226
|
if (node) {
|
|
229
|
-
var _node$textContent;
|
|
230
227
|
if (node.firstElementChild) {
|
|
231
228
|
return;
|
|
232
229
|
}
|
|
233
|
-
const txt =
|
|
234
|
-
if (
|
|
230
|
+
const txt = node.textContent?.trim();
|
|
231
|
+
if (txt?.length === 0) {
|
|
235
232
|
ed.execCommand('Unlink');
|
|
236
233
|
}
|
|
237
234
|
}
|
|
@@ -20,10 +20,9 @@ import React from 'react';
|
|
|
20
20
|
import ReactDOM from 'react-dom';
|
|
21
21
|
import Bridge from '../../../bridge';
|
|
22
22
|
export default function (ed, document) {
|
|
23
|
-
return import('./components/Embed').then(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
23
|
+
return import('./components/Embed').then(({
|
|
24
|
+
Embed
|
|
25
|
+
}) => {
|
|
27
26
|
let container = document.querySelector('.canvas-rce-embed-container');
|
|
28
27
|
if (!container) {
|
|
29
28
|
container = document.createElement('div');
|
|
@@ -23,17 +23,16 @@ import { Button, CloseButton } from '@instructure/ui-buttons';
|
|
|
23
23
|
import { Heading } from '@instructure/ui-heading';
|
|
24
24
|
import { func } from 'prop-types';
|
|
25
25
|
import { TextArea } from '@instructure/ui-text-area';
|
|
26
|
-
import {
|
|
27
|
-
export function Embed(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
26
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
27
|
+
export function Embed({
|
|
28
|
+
onSubmit,
|
|
29
|
+
onDismiss
|
|
30
|
+
}) {
|
|
32
31
|
const [embedCode, setEmbedCode] = useState('');
|
|
33
32
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
34
33
|
"data-mce-component": true,
|
|
35
34
|
label: formatMessage('Embed'),
|
|
36
|
-
mountNode:
|
|
35
|
+
mountNode: instuiPopupMountNodeFn,
|
|
37
36
|
size: "medium",
|
|
38
37
|
onDismiss: onDismiss,
|
|
39
38
|
open: true,
|
|
@@ -56,7 +56,6 @@ function initStore(initProps) {
|
|
|
56
56
|
})
|
|
57
57
|
// @ts-expect-error
|
|
58
58
|
.catch(_err => {
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
59
|
console.error('The Paste plugin failed to get canvas session data.');
|
|
61
60
|
});
|
|
62
61
|
} else {
|
|
@@ -122,12 +121,11 @@ tinymce.PluginManager.add('instructure_paste', function (editor) {
|
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
async function handlePasteOrDrop(event) {
|
|
125
|
-
var _bridge$activeEditor, _bridge$activeEditor$, _editor$rceWrapper;
|
|
126
124
|
const isPaste = event.type === 'paste';
|
|
127
125
|
const dataTransfer = isPaste ? event.clipboardData : event.dataTransfer;
|
|
128
|
-
const files = Array.from(
|
|
129
|
-
const types =
|
|
130
|
-
const isAudioVideoDisabled =
|
|
126
|
+
const files = Array.from(dataTransfer?.files || []);
|
|
127
|
+
const types = dataTransfer?.types || [];
|
|
128
|
+
const isAudioVideoDisabled = bridge.activeEditor()?.props?.instRecordDisabled;
|
|
131
129
|
|
|
132
130
|
// delegate to tiny if there aren't any files to handle
|
|
133
131
|
if (!types.includes('Files')) return;
|
|
@@ -142,7 +140,7 @@ tinymce.PluginManager.add('instructure_paste', function (editor) {
|
|
|
142
140
|
|
|
143
141
|
// Ensure the editor has focus, because downstream code requires that it does, and drag-n-drop
|
|
144
142
|
// events can be started when the editor doesn't have focus.
|
|
145
|
-
if (!editor.hasFocus())
|
|
143
|
+
if (!editor.hasFocus()) editor.rceWrapper?.focus();
|
|
146
144
|
|
|
147
145
|
// Checking if we've encountered an issue with file processing for paste events in the browser
|
|
148
146
|
// Specifically implementing due to this bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1699743
|
|
@@ -163,7 +161,7 @@ tinymce.PluginManager.add('instructure_paste', function (editor) {
|
|
|
163
161
|
|
|
164
162
|
// This will finish once the dialog is closed, if one was created, putting this in a loop allows us
|
|
165
163
|
// to show a dialog for each file without them conflicting.
|
|
166
|
-
|
|
164
|
+
|
|
167
165
|
await requestFileInsertion(file);
|
|
168
166
|
}
|
|
169
167
|
}
|
|
@@ -25,39 +25,33 @@ import { fallbackIframeAllowances } from './constants';
|
|
|
25
25
|
* They're actually the available LTI Tool configurations, so we give them a more reasonable name here.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Subset of TinyMCE used by the ExternalTools dialog. Used to document the subset of the API that we use so
|
|
30
|
-
* it's easier to test.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
28
|
/**
|
|
34
29
|
* Gets the environment information for the external tools dialog for a given tinyMCE editor.
|
|
35
30
|
*/
|
|
36
31
|
export function externalToolsEnvFor(editor) {
|
|
37
32
|
const props = () => {
|
|
38
|
-
var _ref
|
|
39
|
-
return (_ref =
|
|
33
|
+
var _ref;
|
|
34
|
+
return (_ref = RCEWrapper.getByEditor(editor)?.props) !== null && _ref !== void 0 ? _ref : undefined;
|
|
40
35
|
};
|
|
41
36
|
let cachedCanvasToolId;
|
|
42
37
|
function nonNullishArray(arr) {
|
|
43
|
-
return arr
|
|
38
|
+
return arr?.filter(it => it != null);
|
|
44
39
|
}
|
|
45
40
|
return {
|
|
46
41
|
editor: editor !== null && editor !== void 0 ? editor : null,
|
|
47
42
|
get rceWrapper() {
|
|
48
|
-
var _RCEWrapper$
|
|
49
|
-
return (_RCEWrapper$
|
|
43
|
+
var _RCEWrapper$getByEdit;
|
|
44
|
+
return (_RCEWrapper$getByEdit = RCEWrapper.getByEditor(editor)) !== null && _RCEWrapper$getByEdit !== void 0 ? _RCEWrapper$getByEdit : null;
|
|
50
45
|
},
|
|
51
46
|
get availableRceLtiTools() {
|
|
52
|
-
var _nonNullishArray
|
|
53
|
-
return (_nonNullishArray = nonNullishArray(
|
|
47
|
+
var _nonNullishArray;
|
|
48
|
+
return (_nonNullishArray = nonNullishArray(props()?.ltiTools)) !== null && _nonNullishArray !== void 0 ? _nonNullishArray : [];
|
|
54
49
|
},
|
|
55
50
|
/**
|
|
56
51
|
* Gets information about the context in which the editor is launched.
|
|
57
52
|
*/
|
|
58
53
|
get contextAssetInfo() {
|
|
59
|
-
|
|
60
|
-
const trayProps = (_props2 = props()) === null || _props2 === void 0 ? void 0 : _props2.trayProps;
|
|
54
|
+
const trayProps = props()?.trayProps;
|
|
61
55
|
if (trayProps != null) {
|
|
62
56
|
var _trayProps$containing;
|
|
63
57
|
const {
|
|
@@ -74,31 +68,30 @@ export function externalToolsEnvFor(editor) {
|
|
|
74
68
|
return null;
|
|
75
69
|
},
|
|
76
70
|
get resourceSelectionUrlOverride() {
|
|
77
|
-
var _props$externalToolsC
|
|
78
|
-
return (_props$externalToolsC =
|
|
71
|
+
var _props$externalToolsC;
|
|
72
|
+
return (_props$externalToolsC = props()?.externalToolsConfig?.resourceSelectionUrlOverride) !== null && _props$externalToolsC !== void 0 ? _props$externalToolsC : null;
|
|
79
73
|
},
|
|
80
74
|
get ltiIframeAllowPolicy() {
|
|
81
|
-
var _nonNullishArray2
|
|
82
|
-
return ((_nonNullishArray2 = nonNullishArray(
|
|
75
|
+
var _nonNullishArray2;
|
|
76
|
+
return ((_nonNullishArray2 = nonNullishArray(props()?.externalToolsConfig?.ltiIframeAllowances)) !== null && _nonNullishArray2 !== void 0 ? _nonNullishArray2 : fallbackIframeAllowances).join('; ');
|
|
83
77
|
},
|
|
84
78
|
get isA2StudentView() {
|
|
85
|
-
var _props$externalToolsC2
|
|
86
|
-
return (_props$externalToolsC2 =
|
|
79
|
+
var _props$externalToolsC2;
|
|
80
|
+
return (_props$externalToolsC2 = props()?.externalToolsConfig?.isA2StudentView) !== null && _props$externalToolsC2 !== void 0 ? _props$externalToolsC2 : false;
|
|
87
81
|
},
|
|
88
82
|
get maxMruTools() {
|
|
89
|
-
var _props$externalToolsC3
|
|
90
|
-
return (_props$externalToolsC3 =
|
|
83
|
+
var _props$externalToolsC3;
|
|
84
|
+
return (_props$externalToolsC3 = props()?.externalToolsConfig?.maxMruTools) !== null && _props$externalToolsC3 !== void 0 ? _props$externalToolsC3 : 5;
|
|
91
85
|
},
|
|
92
86
|
get canvasOrigin() {
|
|
93
|
-
var _props$canvasOrigin
|
|
94
|
-
return (_props$canvasOrigin =
|
|
87
|
+
var _props$canvasOrigin;
|
|
88
|
+
return (_props$canvasOrigin = props()?.canvasOrigin) !== null && _props$canvasOrigin !== void 0 ? _props$canvasOrigin : window.location.origin;
|
|
95
89
|
},
|
|
96
90
|
/**
|
|
97
91
|
* Gets the context id that should be used when launching LTI iframes.
|
|
98
92
|
*/
|
|
99
93
|
get containingCanvasLtiToolId() {
|
|
100
|
-
|
|
101
|
-
const propsToolId = (_props8 = props()) === null || _props8 === void 0 ? void 0 : (_props8$externalTools = _props8.externalToolsConfig) === null || _props8$externalTools === void 0 ? void 0 : _props8$externalTools.containingCanvasLtiToolId;
|
|
94
|
+
const propsToolId = props()?.externalToolsConfig?.containingCanvasLtiToolId;
|
|
102
95
|
if (typeof propsToolId === 'string') {
|
|
103
96
|
return propsToolId;
|
|
104
97
|
}
|
|
@@ -113,22 +106,20 @@ export function externalToolsEnvFor(editor) {
|
|
|
113
106
|
}
|
|
114
107
|
},
|
|
115
108
|
get editorSelection() {
|
|
116
|
-
var _editor$selection$get
|
|
117
|
-
return (_editor$selection$get = editor
|
|
109
|
+
var _editor$selection$get;
|
|
110
|
+
return (_editor$selection$get = editor?.selection?.getContent()) !== null && _editor$selection$get !== void 0 ? _editor$selection$get : null;
|
|
118
111
|
},
|
|
119
112
|
get editorContent() {
|
|
120
113
|
var _editor$getContent;
|
|
121
|
-
return (_editor$getContent = editor
|
|
114
|
+
return (_editor$getContent = editor?.getContent()) !== null && _editor$getContent !== void 0 ? _editor$getContent : null;
|
|
122
115
|
},
|
|
123
116
|
insertCode(code) {
|
|
124
|
-
|
|
125
|
-
if ((_this$rceWrapper = this.rceWrapper) !== null && _this$rceWrapper !== void 0 && _this$rceWrapper.insertCode) {
|
|
117
|
+
if (this.rceWrapper?.insertCode) {
|
|
126
118
|
this.rceWrapper.insertCode(code);
|
|
127
119
|
}
|
|
128
120
|
},
|
|
129
121
|
replaceCode(code) {
|
|
130
|
-
|
|
131
|
-
if ((_this$rceWrapper2 = this.rceWrapper) !== null && _this$rceWrapper2 !== void 0 && _this$rceWrapper2.replaceCode) {
|
|
122
|
+
if (this.rceWrapper?.replaceCode) {
|
|
132
123
|
this.rceWrapper.replaceCode(code);
|
|
133
124
|
}
|
|
134
125
|
}
|