@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
|
@@ -38,7 +38,7 @@ import { validIcon } from '../utils/iconValidation';
|
|
|
38
38
|
import { IconMakerFormHasChanges } from '../utils/IconMakerFormHasChanges';
|
|
39
39
|
import bridge from '../../../../bridge';
|
|
40
40
|
import { shouldIgnoreClose } from '../utils/IconMakerClose';
|
|
41
|
-
import {
|
|
41
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
42
42
|
const INVALID_MESSAGE = formatMessage('One of the following styles must be added to save an icon: Icon Color, Outline Size, Icon Text, or Image');
|
|
43
43
|
const UNSAVED_CHANGES_MESSAGE = formatMessage('You have unsaved changes in the Icon Maker tray. Do you want to continue without saving these changes?');
|
|
44
44
|
function renderHeader(title, settings, onKeyDown, onAlertDismissal, onClose) {
|
|
@@ -109,13 +109,12 @@ function renderFooter(status, onClose, handleSubmit, editing, replaceAll, setRep
|
|
|
109
109
|
isModified: isModified
|
|
110
110
|
}));
|
|
111
111
|
}
|
|
112
|
-
export function IconMakerTray(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
} = _ref;
|
|
112
|
+
export function IconMakerTray({
|
|
113
|
+
editor,
|
|
114
|
+
onUnmount,
|
|
115
|
+
editing,
|
|
116
|
+
canvasOrigin
|
|
117
|
+
}) {
|
|
119
118
|
const nameRef = useRef();
|
|
120
119
|
const applyRef = useRef();
|
|
121
120
|
const [isOpen, setIsOpen] = useState(true);
|
|
@@ -127,9 +126,9 @@ export function IconMakerTray(_ref) {
|
|
|
127
126
|
...defaultState
|
|
128
127
|
});
|
|
129
128
|
const isModified = useRef(false);
|
|
130
|
-
const [mountNode, setMountNode] = useState(
|
|
129
|
+
const [mountNode, setMountNode] = useState(instuiPopupMountNodeFn());
|
|
131
130
|
const handleFullscreenChange = useCallback(() => {
|
|
132
|
-
setMountNode(
|
|
131
|
+
setMountNode(instuiPopupMountNodeFn());
|
|
133
132
|
}, []);
|
|
134
133
|
|
|
135
134
|
// These useRef objects are needed because when the tray is closed using the escape key
|
|
@@ -142,11 +141,9 @@ export function IconMakerTray(_ref) {
|
|
|
142
141
|
statusRef.current = useMemo(() => status, [status]);
|
|
143
142
|
initialSettingsRef.current = useMemo(() => initialSettings, [initialSettings]);
|
|
144
143
|
useEffect(() => {
|
|
145
|
-
|
|
146
|
-
editor === null || editor === void 0 ? void 0 : (_editor$rceWrapper = editor.rceWrapper) === null || _editor$rceWrapper === void 0 ? void 0 : (_editor$rceWrapper$_e = _editor$rceWrapper._elementRef) === null || _editor$rceWrapper$_e === void 0 ? void 0 : (_editor$rceWrapper$_e2 = _editor$rceWrapper$_e.current) === null || _editor$rceWrapper$_e2 === void 0 ? void 0 : _editor$rceWrapper$_e2.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
144
|
+
editor?.rceWrapper?._elementRef?.current?.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
147
145
|
return () => {
|
|
148
|
-
|
|
149
|
-
editor === null || editor === void 0 ? void 0 : (_editor$rceWrapper2 = editor.rceWrapper) === null || _editor$rceWrapper2 === void 0 ? void 0 : (_editor$rceWrapper2$_ = _editor$rceWrapper2._elementRef) === null || _editor$rceWrapper2$_ === void 0 ? void 0 : (_editor$rceWrapper2$_2 = _editor$rceWrapper2$_.current) === null || _editor$rceWrapper2$_2 === void 0 ? void 0 : _editor$rceWrapper2$_2.removeEventListener('fullscreenchange', handleFullscreenChange);
|
|
146
|
+
editor?.rceWrapper?._elementRef?.current?.removeEventListener('fullscreenchange', handleFullscreenChange);
|
|
150
147
|
};
|
|
151
148
|
}, [editor, handleFullscreenChange]);
|
|
152
149
|
useEffect(() => {
|
|
@@ -155,14 +152,14 @@ export function IconMakerTray(_ref) {
|
|
|
155
152
|
}, [settings, initialSettings]);
|
|
156
153
|
const storeProps = useStoreProps();
|
|
157
154
|
const onClose = event => {
|
|
158
|
-
if (shouldIgnoreClose(event
|
|
159
|
-
if (
|
|
155
|
+
if (shouldIgnoreClose(event?.target, editor?.id)) return;
|
|
156
|
+
if (statusRef?.current === statuses.LOADING) return;
|
|
160
157
|
// Uploading an image creates a modal on the page. If that modal is open, we don't want to close the tray
|
|
161
158
|
// eslint-disable-next-line no-extra-boolean-cast
|
|
162
159
|
if (!!hasOpenModal()) return;
|
|
163
160
|
// RCE already uses browser's confirm dialog for unsaved changes
|
|
164
161
|
// Its use here in the Icon Maker tray keeps that consistency
|
|
165
|
-
|
|
162
|
+
|
|
166
163
|
if (isModified.current && !confirm(UNSAVED_CHANGES_MESSAGE)) {
|
|
167
164
|
return;
|
|
168
165
|
}
|
|
@@ -171,10 +168,9 @@ export function IconMakerTray(_ref) {
|
|
|
171
168
|
const hasOpenModal = () => document.querySelector('[data-cid="Modal"]');
|
|
172
169
|
const isLoading = () => status === statuses.LOADING;
|
|
173
170
|
const onKeyDown = event => {
|
|
174
|
-
var _applyRef$current, _nameRef$current;
|
|
175
171
|
if (event.keyCode !== 9) return;
|
|
176
172
|
event.preventDefault();
|
|
177
|
-
event.shiftKey ?
|
|
173
|
+
event.shiftKey ? applyRef.current?.focus() : nameRef.current?.focus();
|
|
178
174
|
};
|
|
179
175
|
useEffect(() => {
|
|
180
176
|
setReplaceAll(false);
|
|
@@ -189,10 +185,9 @@ export function IconMakerTray(_ref) {
|
|
|
189
185
|
}
|
|
190
186
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
187
|
}, [settings.color, settings.textColor, settings.text, settings.textSize, settings.textBackgroundColor, settings.textPosition, settings.imageSettings, settings.outlineColor, settings.outlineSize, settings.name]);
|
|
192
|
-
const handleSubmit =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
} = _ref2;
|
|
188
|
+
const handleSubmit = ({
|
|
189
|
+
replaceFile = false
|
|
190
|
+
}) => {
|
|
196
191
|
setStatus(statuses.LOADING);
|
|
197
192
|
if (!validIcon(settings)) {
|
|
198
193
|
dispatch({
|
|
@@ -212,16 +207,14 @@ export function IconMakerTray(_ref) {
|
|
|
212
207
|
}, {
|
|
213
208
|
onDuplicate: replaceFile && 'overwrite'
|
|
214
209
|
}).then(writeIconToRCE).then(() => setIsOpen(false)).catch(err => {
|
|
215
|
-
// eslint-disable-next-line no-console
|
|
216
210
|
console.error(err);
|
|
217
211
|
setStatus(statuses.ERROR);
|
|
218
212
|
});
|
|
219
213
|
};
|
|
220
|
-
const writeIconToRCE =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
} = _ref3;
|
|
214
|
+
const writeIconToRCE = ({
|
|
215
|
+
url,
|
|
216
|
+
display_name
|
|
217
|
+
}) => {
|
|
225
218
|
const {
|
|
226
219
|
alt,
|
|
227
220
|
isDecorative,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import formatMessage from '../../../format-message';
|
|
20
20
|
import { BUTTON_ID, TOOLBAR_ID, ICON_MAKER_ATTRIBUTE } from './svg/constants';
|
|
21
21
|
import TrayController from '../instructure_image/ImageOptionsTray/TrayController';
|
|
22
|
-
export const shouldShowEditButton = node => !!
|
|
22
|
+
export const shouldShowEditButton = node => !!node?.getAttribute(ICON_MAKER_ATTRIBUTE);
|
|
23
23
|
export const EDIT_ALT_TEXT_BUTTON_ID = 'inst-icon-maker-edit-alt-text';
|
|
24
24
|
const trayController = new TrayController();
|
|
25
25
|
export default function registerEditToolbar(editor, onAction) {
|
|
@@ -21,11 +21,10 @@ import { CLIP_PATH_ID } from './clipPath';
|
|
|
21
21
|
import { Shape } from './shape';
|
|
22
22
|
import { Size, STROKE_WIDTH, BASE_SIZE, ICON_PADDING } from './constants';
|
|
23
23
|
const STOCK_IMAGE_TYPES = ['SingleColor', 'MultiColor'];
|
|
24
|
-
const calculateImageHeight =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
24
|
+
const calculateImageHeight = ({
|
|
25
|
+
size,
|
|
26
|
+
outlineSize
|
|
27
|
+
}) => {
|
|
29
28
|
// Subtract the padding at the top and the bottom
|
|
30
29
|
// to get the true height of the shape in the icon
|
|
31
30
|
const iconHeightLessPadding = BASE_SIZE[size] - 2 * ICON_PADDING;
|
|
@@ -35,9 +34,8 @@ const calculateImageHeight = _ref => {
|
|
|
35
34
|
return iconHeightLessPadding - STROKE_WIDTH[outlineSize];
|
|
36
35
|
};
|
|
37
36
|
export function buildImage(settings) {
|
|
38
|
-
var _settings$imageSettin;
|
|
39
37
|
// Don't attempt to embed an image if none exist
|
|
40
|
-
if (!
|
|
38
|
+
if (!settings.imageSettings?.image) return;
|
|
41
39
|
let imageAttributes;
|
|
42
40
|
if (STOCK_IMAGE_TYPES.includes(settings.imageSettings.mode)) {
|
|
43
41
|
imageAttributes = {
|
|
@@ -24,8 +24,7 @@ import { buildImage } from './image';
|
|
|
24
24
|
import { buildClipPath } from './clipPath';
|
|
25
25
|
import { buildText, buildTextBackground, getContainerWidth, getContainerHeight } from './text';
|
|
26
26
|
import base64EncodedFont from './font';
|
|
27
|
-
export function buildSvg(settings) {
|
|
28
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
export function buildSvg(settings, options = {}) {
|
|
29
28
|
settings = {
|
|
30
29
|
...DEFAULT_SETTINGS,
|
|
31
30
|
...settings
|
|
@@ -100,13 +99,11 @@ export function buildSvgContainer(settings, options) {
|
|
|
100
99
|
if (options.isPreview) attributes.style = 'padding: 16px';
|
|
101
100
|
return createSvgElement('svg', attributes);
|
|
102
101
|
}
|
|
103
|
-
export function buildGroup(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} = _ref;
|
|
109
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
102
|
+
export function buildGroup({
|
|
103
|
+
color,
|
|
104
|
+
outlineColor,
|
|
105
|
+
outlineSize
|
|
106
|
+
}, options = {}) {
|
|
110
107
|
const g = createSvgElement('g');
|
|
111
108
|
if (options.fill) {
|
|
112
109
|
g.setAttribute('fill', color || 'none');
|
|
@@ -29,11 +29,10 @@ export const statuses = {
|
|
|
29
29
|
IDLE: 'idle'
|
|
30
30
|
};
|
|
31
31
|
const getImageNode = (editor, editing) => {
|
|
32
|
-
var _editor$selection;
|
|
33
32
|
// If the user is creating an icon rather then editing, no sense trying
|
|
34
33
|
// to get an existing SVG URL
|
|
35
34
|
if (!editing) return;
|
|
36
|
-
const selectedNode = editor
|
|
35
|
+
const selectedNode = editor?.selection?.getNode();
|
|
37
36
|
|
|
38
37
|
// No selection made, return
|
|
39
38
|
if (!selectedNode) return;
|
|
@@ -64,21 +63,20 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
|
|
|
64
63
|
const [settings, dispatch] = useReducer(svgSettingsReducer, defaultState);
|
|
65
64
|
const [status, setStatus] = useState(statuses.IDLE);
|
|
66
65
|
const imgNode = getImageNode(editor, editing);
|
|
67
|
-
const urlFromNode = imgNode
|
|
68
|
-
const altText = imgNode
|
|
69
|
-
const customStyle = imgNode
|
|
70
|
-
const customWidth = imgNode
|
|
71
|
-
const customHeight = imgNode
|
|
66
|
+
const urlFromNode = imgNode?.getAttribute(ICON_MAKER_DOWNLOAD_URL_ATTR);
|
|
67
|
+
const altText = imgNode?.getAttribute('alt');
|
|
68
|
+
const customStyle = imgNode?.getAttribute('style');
|
|
69
|
+
const customWidth = imgNode?.getAttribute('width');
|
|
70
|
+
const customHeight = imgNode?.getAttribute('height');
|
|
72
71
|
useEffect(() => {
|
|
73
72
|
const fetchSvgSettings = async () => {
|
|
74
73
|
if (!urlFromNode) return;
|
|
75
74
|
try {
|
|
76
|
-
var _urlFromNode$split$;
|
|
77
75
|
setStatus(statuses.LOADING);
|
|
78
76
|
|
|
79
77
|
// Parse out the file ID from something like
|
|
80
78
|
// /courses/1/files/3/preview?...
|
|
81
|
-
const fileId =
|
|
79
|
+
const fileId = urlFromNode.split('files/')[1]?.split('/')[0];
|
|
82
80
|
const downloadUrl = buildMetadataUrl(fileId, canvasOrigin);
|
|
83
81
|
|
|
84
82
|
// Download icon metadata. If no metadata found, return defaults
|
|
@@ -107,13 +105,13 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
|
|
|
107
105
|
const {
|
|
108
106
|
imageSettings
|
|
109
107
|
} = metadataJson;
|
|
110
|
-
if (imageSettings
|
|
108
|
+
if (imageSettings?.cropperSettings) {
|
|
111
109
|
const generatedSvg = await createCroppedImageSvg(imageSettings.cropperSettings, imageSettings.image);
|
|
112
110
|
metadataJson.embedImage = await convertFileToBase64(new Blob([generatedSvg.outerHTML], {
|
|
113
111
|
type: 'image/svg+xml'
|
|
114
112
|
}));
|
|
115
113
|
} else {
|
|
116
|
-
metadataJson.embedImage =
|
|
114
|
+
metadataJson.embedImage = imageSettings?.image || defaultState.embedImage;
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
// settings found, return parsed results
|
|
@@ -130,9 +128,8 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
|
|
|
130
128
|
return [settings, status, dispatch];
|
|
131
129
|
}
|
|
132
130
|
function processMetadataForBackwardCompatibility(metadataJson) {
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
const mode = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe2 = metadataJson.imageSettings) === null || _metadataJson$imageSe2 === void 0 ? void 0 : _metadataJson$imageSe2.mode;
|
|
131
|
+
const icon = metadataJson?.imageSettings?.icon;
|
|
132
|
+
const mode = metadataJson?.imageSettings?.mode;
|
|
136
133
|
if (mode === modes.singleColorImages.type && typeof icon === 'object') {
|
|
137
134
|
const foundIconId = iconsLabels[icon.label];
|
|
138
135
|
if (foundIconId) {
|
|
@@ -144,9 +141,9 @@ function processMetadataForBackwardCompatibility(metadataJson) {
|
|
|
144
141
|
|
|
145
142
|
// On old icons we stored the original image inside cropper settings
|
|
146
143
|
// If that's the case we are copying it to the correct place
|
|
147
|
-
const cropperSettingsImage = metadataJson
|
|
148
|
-
const imageSettingsImage = metadataJson
|
|
149
|
-
const encodedImage = metadataJson
|
|
144
|
+
const cropperSettingsImage = metadataJson?.imageSettings?.cropperSettings?.image;
|
|
145
|
+
const imageSettingsImage = metadataJson?.imageSettings?.image;
|
|
146
|
+
const encodedImage = metadataJson?.encodedImage;
|
|
150
147
|
if (imageSettingsImage && cropperSettingsImage && imageSettingsImage !== cropperSettingsImage) {
|
|
151
148
|
metadataJson.imageSettings.image = cropperSettingsImage || imageSettingsImage || encodedImage || '';
|
|
152
149
|
delete metadataJson.imageSettings.cropperSettings.image;
|
|
@@ -158,14 +155,14 @@ function processMetadataForBackwardCompatibility(metadataJson) {
|
|
|
158
155
|
delete metadataJson.encodedImageName;
|
|
159
156
|
|
|
160
157
|
// Cleans image settings if there is no image or icon
|
|
161
|
-
const imageSettingsIcon = metadataJson
|
|
158
|
+
const imageSettingsIcon = metadataJson?.imageSettings?.icon;
|
|
162
159
|
if (!imageSettingsImage && !imageSettingsIcon) {
|
|
163
160
|
metadataJson.imageSettings = null;
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
// Replaces cropper settings' shape using icon's shape
|
|
167
|
-
const cropperSettingsShape = metadataJson
|
|
168
|
-
const shape = metadataJson
|
|
164
|
+
const cropperSettingsShape = metadataJson?.imageSettings?.cropperSettings?.shape;
|
|
165
|
+
const shape = metadataJson?.shape;
|
|
169
166
|
if (shape && cropperSettingsShape && shape !== cropperSettingsShape) {
|
|
170
167
|
metadataJson.imageSettings.cropperSettings.shape = shape;
|
|
171
168
|
}
|
|
@@ -28,11 +28,10 @@ export const Shape = {
|
|
|
28
28
|
Octagon: 'octagon',
|
|
29
29
|
Star: 'star'
|
|
30
30
|
};
|
|
31
|
-
export function buildShape(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
31
|
+
export function buildShape({
|
|
32
|
+
shape,
|
|
33
|
+
size
|
|
34
|
+
}) {
|
|
36
35
|
switch (shape) {
|
|
37
36
|
case Shape.Square:
|
|
38
37
|
return buildSquare(size);
|
|
@@ -19,15 +19,14 @@
|
|
|
19
19
|
import { createSvgElement, splitTextIntoLines } from './utils';
|
|
20
20
|
import { TEXT_BACKGROUND_PADDING, BASE_SIZE, TEXT_SIZE, MAX_CHAR_COUNT, Size, TEXT_SIZE_FONT_DIFF } from './constants';
|
|
21
21
|
import { Shape } from './shape';
|
|
22
|
-
export function buildText(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
22
|
+
export function buildText({
|
|
23
|
+
text,
|
|
24
|
+
textPosition,
|
|
25
|
+
textSize,
|
|
26
|
+
textColor,
|
|
27
|
+
shape,
|
|
28
|
+
size
|
|
29
|
+
}) {
|
|
31
30
|
if (!text.trim()) return null;
|
|
32
31
|
const lines = splitTextIntoLines(text, MAX_CHAR_COUNT[textSize]);
|
|
33
32
|
const textElement = createSvgElement('text', {
|
|
@@ -54,15 +53,14 @@ export function buildText(_ref) {
|
|
|
54
53
|
});
|
|
55
54
|
return textElement;
|
|
56
55
|
}
|
|
57
|
-
export function buildTextBackground(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} = _ref2;
|
|
56
|
+
export function buildTextBackground({
|
|
57
|
+
text,
|
|
58
|
+
textPosition,
|
|
59
|
+
textSize,
|
|
60
|
+
textBackgroundColor,
|
|
61
|
+
shape,
|
|
62
|
+
size
|
|
63
|
+
}) {
|
|
66
64
|
if (!text.trim()) return null;
|
|
67
65
|
const linesCount = splitTextIntoLines(text, MAX_CHAR_COUNT[textSize]).length;
|
|
68
66
|
const xValue = getTextXValue(text, textSize, size);
|
|
@@ -83,25 +81,23 @@ export function buildTextBackground(_ref2) {
|
|
|
83
81
|
pathElement.setAttribute('fill', textBackgroundColor || '');
|
|
84
82
|
return pathElement;
|
|
85
83
|
}
|
|
86
|
-
export function getContainerWidth(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} = _ref3;
|
|
84
|
+
export function getContainerWidth({
|
|
85
|
+
text,
|
|
86
|
+
textSize,
|
|
87
|
+
size
|
|
88
|
+
}) {
|
|
92
89
|
const fontWeight = 2;
|
|
93
90
|
const base = BASE_SIZE[size];
|
|
94
91
|
const textWidth = Math.floor(getTextWidth(text, textSize)) + TEXT_BACKGROUND_PADDING * 2 + fontWeight;
|
|
95
92
|
return Math.max(base, textWidth);
|
|
96
93
|
}
|
|
97
|
-
export function getContainerHeight(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} = _ref4;
|
|
94
|
+
export function getContainerHeight({
|
|
95
|
+
text,
|
|
96
|
+
textPosition,
|
|
97
|
+
textSize,
|
|
98
|
+
shape,
|
|
99
|
+
size
|
|
100
|
+
}) {
|
|
105
101
|
const base = BASE_SIZE[size];
|
|
106
102
|
if (!text || text.trim().length === 0) {
|
|
107
103
|
return base;
|
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
export function createSvgElement(tag) {
|
|
20
|
-
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
+
export function createSvgElement(tag, attributes = {}) {
|
|
21
20
|
const element = document.createElementNS('http://www.w3.org/2000/svg', tag);
|
|
22
|
-
Object.entries(attributes).forEach(
|
|
23
|
-
let [attr, value] = _ref;
|
|
21
|
+
Object.entries(attributes).forEach(([attr, value]) => {
|
|
24
22
|
element.setAttribute(attr, value);
|
|
25
23
|
});
|
|
26
24
|
return element;
|
|
@@ -30,12 +30,11 @@ export const shouldIgnoreClose = (target, editorId) => {
|
|
|
30
30
|
};
|
|
31
31
|
const elementTreeHasAttribute = (target, attribute, value) => {
|
|
32
32
|
while (target) {
|
|
33
|
-
var _target, _target$attributes, _target$attributes$at, _target2;
|
|
34
33
|
// @ts-expect-error
|
|
35
|
-
if (
|
|
34
|
+
if (target?.attributes?.[attribute]?.value === value) {
|
|
36
35
|
return true;
|
|
37
36
|
}
|
|
38
|
-
target =
|
|
37
|
+
target = target?.parentElement;
|
|
39
38
|
}
|
|
40
39
|
return false;
|
|
41
40
|
};
|
|
@@ -23,8 +23,7 @@ export const hasText = settings => {
|
|
|
23
23
|
return settings.text.length > 0;
|
|
24
24
|
};
|
|
25
25
|
export const hasImage = settings => {
|
|
26
|
-
|
|
27
|
-
return ((_settings$imageSettin = settings.imageSettings) === null || _settings$imageSettin === void 0 ? void 0 : _settings$imageSettin.image.length) > 0;
|
|
26
|
+
return settings.imageSettings?.image.length > 0;
|
|
28
27
|
};
|
|
29
28
|
export const hasOutline = settings => {
|
|
30
29
|
return settings.outlineSize !== 'none';
|
|
@@ -109,8 +109,7 @@ export function fromVideoEmbed($element) {
|
|
|
109
109
|
source: $videoElem && $videoElem.querySelector('source')
|
|
110
110
|
};
|
|
111
111
|
try {
|
|
112
|
-
|
|
113
|
-
const trackjson = (_$videoDoc$querySelec = $videoDoc.querySelector('[data-tracks]')) === null || _$videoDoc$querySelec === void 0 ? void 0 : _$videoDoc$querySelec.getAttribute('data-tracks');
|
|
112
|
+
const trackjson = $videoDoc.querySelector('[data-tracks]')?.getAttribute('data-tracks');
|
|
114
113
|
if (trackjson) {
|
|
115
114
|
videoOptions.tracks = JSON.parse(trackjson);
|
|
116
115
|
}
|
|
@@ -120,7 +119,7 @@ export function fromVideoEmbed($element) {
|
|
|
120
119
|
videoOptions.videoSize = imageSizeFromKnownOptions(videoOptions);
|
|
121
120
|
if (RCEGlobals.getFeatures().media_links_use_attachment_id) {
|
|
122
121
|
const source = $videoIframe.getAttribute('src');
|
|
123
|
-
const matches = source
|
|
122
|
+
const matches = source?.match(/\/media_attachments_iframe\/(\d+)/);
|
|
124
123
|
if (matches) {
|
|
125
124
|
videoOptions.attachmentId = matches[1];
|
|
126
125
|
}
|
|
@@ -148,10 +147,7 @@ export function scaleToSize(imageSize, naturalWidth, naturalHeight) {
|
|
|
148
147
|
height: naturalHeight
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
|
-
const [dimension] = Object.entries(sizeByMaximumDimension).find(
|
|
152
|
-
let [, size] = _ref;
|
|
153
|
-
return size === imageSize;
|
|
154
|
-
});
|
|
150
|
+
const [dimension] = Object.entries(sizeByMaximumDimension).find(([, size]) => size === imageSize);
|
|
155
151
|
const scaleFactor = dimension / Math.max(naturalWidth, naturalHeight);
|
|
156
152
|
return {
|
|
157
153
|
height: Math.round(naturalHeight * scaleFactor),
|
|
@@ -26,14 +26,13 @@ import { View } from '@instructure/ui-view';
|
|
|
26
26
|
import dragHtml from '../../../../sidebar/dragHtml';
|
|
27
27
|
import formatMessage from '../../../../format-message';
|
|
28
28
|
import { renderImage } from '../../../contentRendering';
|
|
29
|
-
export default function Image(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref;
|
|
29
|
+
export default function Image({
|
|
30
|
+
focusRef,
|
|
31
|
+
image,
|
|
32
|
+
onClick,
|
|
33
|
+
isIconMaker,
|
|
34
|
+
canvasOrigin
|
|
35
|
+
}) {
|
|
37
36
|
const imgTitle = formatMessage('Click to embed {imageName}', {
|
|
38
37
|
imageName: image.display_name
|
|
39
38
|
});
|
|
@@ -20,14 +20,13 @@ import React from 'react';
|
|
|
20
20
|
import { arrayOf, func, instanceOf, shape, bool, string } from 'prop-types';
|
|
21
21
|
import { Flex } from '@instructure/ui-flex';
|
|
22
22
|
import Image from './Image';
|
|
23
|
-
export default function ImageList(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
23
|
+
export default function ImageList({
|
|
24
|
+
images,
|
|
25
|
+
lastItemRef,
|
|
26
|
+
onImageClick,
|
|
27
|
+
isIconMaker,
|
|
28
|
+
canvasOrigin
|
|
29
|
+
}) {
|
|
31
30
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
32
31
|
justifyItems: "start",
|
|
33
32
|
height: "100%",
|
|
@@ -45,8 +45,7 @@ export default class TrayController {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Tray may be called to edit an Icon Maker icon alt text
|
|
48
|
-
showTrayForEditor(editor) {
|
|
49
|
-
let isIconMaker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
48
|
+
showTrayForEditor(editor, isIconMaker = false) {
|
|
50
49
|
this._editor = editor;
|
|
51
50
|
this.$img = editor.selection.getNode();
|
|
52
51
|
this._shouldOpen = true;
|
|
@@ -113,7 +112,6 @@ export default class TrayController {
|
|
|
113
112
|
this._editor = null;
|
|
114
113
|
}
|
|
115
114
|
_renderTray() {
|
|
116
|
-
var _this$_editor, _this$_editor$selecti;
|
|
117
115
|
if (this._shouldOpen) {
|
|
118
116
|
/*
|
|
119
117
|
* When the tray is being opened again, it should be rendered fresh
|
|
@@ -123,7 +121,7 @@ export default class TrayController {
|
|
|
123
121
|
this._renderId++;
|
|
124
122
|
}
|
|
125
123
|
const io = asImageEmbed(this.$img);
|
|
126
|
-
io.isLinked =
|
|
124
|
+
io.isLinked = this._editor?.selection?.getSel().anchorNode.tagName === 'A';
|
|
127
125
|
const element = /*#__PURE__*/React.createElement(ImageOptionsTray, {
|
|
128
126
|
key: this._renderId,
|
|
129
127
|
imageOptions: io,
|
|
@@ -29,7 +29,7 @@ import ImageOptionsForm from '../../shared/ImageOptionsForm';
|
|
|
29
29
|
import { getTrayHeight, isExternalUrl } from '../../shared/trayUtils';
|
|
30
30
|
import validateURL from '../../instructure_links/validateURL';
|
|
31
31
|
import UrlPanel from '../../shared/Upload/UrlPanel';
|
|
32
|
-
import {
|
|
32
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
33
33
|
export default function ImageOptionsTray(props) {
|
|
34
34
|
const {
|
|
35
35
|
imageOptions,
|
|
@@ -135,14 +135,14 @@ export default function ImageOptionsTray(props) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
const disableForIcons = isIconMaker && !isDecorativeImage && altText === '';
|
|
138
|
-
const disableForImages = url === '' || displayAs === 'embed' && (!isDecorativeImage && altText === '' || imageSize === CUSTOM && !
|
|
138
|
+
const disableForImages = url === '' || displayAs === 'embed' && (!isDecorativeImage && altText === '' || imageSize === CUSTOM && !dimensionsState?.isValid);
|
|
139
139
|
const saveDisabled = isIconMaker ? disableForIcons : disableForImages;
|
|
140
140
|
const trayLabel = isIconMaker ? formatMessage('Icon Options Tray') : formatMessage('Image Options Tray');
|
|
141
141
|
const trayHeading = isIconMaker ? formatMessage('Icon Options') : formatMessage('Image Options');
|
|
142
142
|
return /*#__PURE__*/React.createElement(Tray, {
|
|
143
143
|
"data-mce-component": true,
|
|
144
144
|
label: trayLabel,
|
|
145
|
-
mountNode:
|
|
145
|
+
mountNode: instuiPopupMountNodeFn,
|
|
146
146
|
onDismiss: onRequestClose,
|
|
147
147
|
onEntered: onEntered,
|
|
148
148
|
onExited: onExited,
|
|
@@ -31,8 +31,7 @@ const trayController = new TrayController();
|
|
|
31
31
|
|
|
32
32
|
// @ts-expect-error
|
|
33
33
|
function getMenuItems(ed) {
|
|
34
|
-
|
|
35
|
-
const contextType = (_ed$settings$canvas_r = ed.settings.canvas_rce_user_context) === null || _ed$settings$canvas_r === void 0 ? void 0 : _ed$settings$canvas_r.type;
|
|
34
|
+
const contextType = ed.settings.canvas_rce_user_context?.type;
|
|
36
35
|
const items = [{
|
|
37
36
|
text: formatMessage('Upload Image'),
|
|
38
37
|
value: 'instructure_upload_image'
|
|
@@ -22,14 +22,13 @@ import formatMessage from '../../../../format-message';
|
|
|
22
22
|
import { ToggleGroup } from '@instructure/ui-toggle-details';
|
|
23
23
|
import { Text } from '@instructure/ui-text';
|
|
24
24
|
import { View } from '@instructure/ui-view';
|
|
25
|
-
export default function AccordionSection(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
25
|
+
export default function AccordionSection({
|
|
26
|
+
collection,
|
|
27
|
+
children,
|
|
28
|
+
onToggle,
|
|
29
|
+
expanded,
|
|
30
|
+
label
|
|
31
|
+
}) {
|
|
33
32
|
const toggleLabel = expanded ? formatMessage('Collapse to hide {types}', {
|
|
34
33
|
types: label
|
|
35
34
|
}) : formatMessage('Expand to see {types}', {
|