@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
|
@@ -84,21 +84,19 @@ const NAMED_COLORS = [{
|
|
|
84
84
|
color: '#FFFFFF',
|
|
85
85
|
name: formatMessage('White')
|
|
86
86
|
}, null];
|
|
87
|
-
export const ColorInput =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
requireColor = false
|
|
98
|
-
} = _ref;
|
|
87
|
+
export const ColorInput = ({
|
|
88
|
+
color,
|
|
89
|
+
label,
|
|
90
|
+
name,
|
|
91
|
+
onChange,
|
|
92
|
+
popoverMountNode,
|
|
93
|
+
width = '11rem',
|
|
94
|
+
readonly = false,
|
|
95
|
+
requireColor = false
|
|
96
|
+
}) => {
|
|
99
97
|
const [isOpen, setIsOpen] = useState(false);
|
|
100
98
|
const [inputValue, setInputValue] = useState(color);
|
|
101
|
-
const colorName =
|
|
99
|
+
const colorName = NAMED_COLORS.find(c => c?.color === color)?.name;
|
|
102
100
|
useEffect(() => {
|
|
103
101
|
setInputValue(color);
|
|
104
102
|
}, [color]);
|
|
@@ -121,12 +119,12 @@ export const ColorInput = _ref => {
|
|
|
121
119
|
}
|
|
122
120
|
};
|
|
123
121
|
const colorPreviews = NAMED_COLORS.map(c => /*#__PURE__*/React.createElement(ColorPreview, {
|
|
124
|
-
key: `${name}-${c
|
|
125
|
-
color: c
|
|
126
|
-
name: c
|
|
122
|
+
key: `${name}-${c?.color}`,
|
|
123
|
+
color: c?.color,
|
|
124
|
+
name: c?.name,
|
|
127
125
|
disabled: !isOpen,
|
|
128
126
|
onSelect: () => {
|
|
129
|
-
handleColorChange(c
|
|
127
|
+
handleColorChange(c?.color);
|
|
130
128
|
setIsOpen(false);
|
|
131
129
|
}
|
|
132
130
|
}));
|
|
@@ -186,14 +184,13 @@ export const ColorInput = _ref => {
|
|
|
186
184
|
interaction: readonly ? 'readonly' : undefined
|
|
187
185
|
}));
|
|
188
186
|
};
|
|
189
|
-
function ColorPreview(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
} = _ref2;
|
|
187
|
+
function ColorPreview({
|
|
188
|
+
color,
|
|
189
|
+
name,
|
|
190
|
+
disabled,
|
|
191
|
+
margin = 'xxx-small',
|
|
192
|
+
onSelect
|
|
193
|
+
}) {
|
|
197
194
|
return /*#__PURE__*/React.createElement(BaseButton, {
|
|
198
195
|
interaction: disabled ? 'readonly' : undefined,
|
|
199
196
|
isCondensed: true,
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
import React from 'react';
|
|
20
20
|
import { bool, element, oneOfType, arrayOf } from 'prop-types';
|
|
21
21
|
import { Tooltip } from '@instructure/ui-tooltip';
|
|
22
|
-
export const ConditionalTooltip =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
22
|
+
export const ConditionalTooltip = ({
|
|
23
|
+
condition,
|
|
24
|
+
children,
|
|
25
|
+
...tooltipProps
|
|
26
|
+
}) => {
|
|
28
27
|
return condition ? /*#__PURE__*/React.createElement(Tooltip, tooltipProps, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
29
28
|
};
|
|
30
29
|
ConditionalTooltip.propTypes = {
|
|
@@ -34,7 +34,7 @@ export const DISPLAY_AS_EMBED = 'embed';
|
|
|
34
34
|
export const DISPLAY_AS_EMBED_DISABLED = 'embed-disabled';
|
|
35
35
|
export const DISPLAY_AS_DOWNLOAD_LINK = 'download-link';
|
|
36
36
|
export function asImageEmbed($element) {
|
|
37
|
-
const nodeName = $element
|
|
37
|
+
const nodeName = $element?.nodeName.toLowerCase();
|
|
38
38
|
if (nodeName !== 'img') {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
@@ -45,9 +45,8 @@ export function asImageEmbed($element) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
export function asLink($element, editor) {
|
|
48
|
-
var _$link;
|
|
49
48
|
let $link = $element;
|
|
50
|
-
if (
|
|
49
|
+
if ($link?.tagName !== 'A') {
|
|
51
50
|
// the user may have selected some text that is w/in a link
|
|
52
51
|
// but didn't include the <a>. Let's see if that's true
|
|
53
52
|
$link = editor && editor.dom.getParent($link, 'a[href]');
|
|
@@ -93,7 +92,6 @@ export function asLink($element, editor) {
|
|
|
93
92
|
// tinymce releases.
|
|
94
93
|
// see https://github.com/tinymce/tinymce/issues/5181
|
|
95
94
|
export function asVideoElement($element) {
|
|
96
|
-
var _$videoElem$parentEle;
|
|
97
95
|
const $videoElem = findMediaPlayerIframe($element);
|
|
98
96
|
if (!isVideoElement($videoElem) && !isStudioEmbeddedMedia($videoElem)) {
|
|
99
97
|
return null;
|
|
@@ -102,11 +100,10 @@ export function asVideoElement($element) {
|
|
|
102
100
|
...fromVideoEmbed($videoElem),
|
|
103
101
|
$element,
|
|
104
102
|
type: VIDEO_EMBED_TYPE,
|
|
105
|
-
id:
|
|
103
|
+
id: $videoElem.parentElement?.getAttribute('data-mce-p-data-media-id') || $videoElem.getAttribute('data-mce-p-data-media-id')
|
|
106
104
|
};
|
|
107
105
|
}
|
|
108
106
|
export function asAudioElement($element) {
|
|
109
|
-
var _$element$parentEleme;
|
|
110
107
|
if (!$element) {
|
|
111
108
|
return null;
|
|
112
109
|
}
|
|
@@ -115,13 +112,12 @@ export function asAudioElement($element) {
|
|
|
115
112
|
const title = ($audioIframe.getAttribute('title') || $tinymceIframeShim.getAttribute('data-mce-p-title') || '').replace(formatMessage('Video player for '), '');
|
|
116
113
|
const audioOptions = {
|
|
117
114
|
titleText: title,
|
|
118
|
-
id:
|
|
115
|
+
id: $element.parentElement?.getAttribute('data-mce-p-data-media-id') || $element.getAttribute('data-mce-p-data-media-id')
|
|
119
116
|
};
|
|
120
117
|
if ($audioIframe.tagName === 'IFRAME') {
|
|
121
118
|
const audioDoc = $audioIframe.contentDocument;
|
|
122
119
|
try {
|
|
123
|
-
|
|
124
|
-
const trackSJson = (_audioDoc$querySelect = audioDoc.querySelector('[data-tracks]')) === null || _audioDoc$querySelect === void 0 ? void 0 : _audioDoc$querySelect.getAttribute('data-tracks');
|
|
120
|
+
const trackSJson = audioDoc.querySelector('[data-tracks]')?.getAttribute('data-tracks');
|
|
125
121
|
if (trackSJson) {
|
|
126
122
|
audioOptions.tracks = JSON.parse(trackSJson);
|
|
127
123
|
}
|
|
@@ -130,7 +126,7 @@ export function asAudioElement($element) {
|
|
|
130
126
|
}
|
|
131
127
|
if (RCEGlobals.getFeatures().media_links_use_attachment_id) {
|
|
132
128
|
const source = $audioIframe.getAttribute('src');
|
|
133
|
-
const matches = source
|
|
129
|
+
const matches = source?.match(/\/media_attachments_iframe\/(\d+)/);
|
|
134
130
|
if (matches) {
|
|
135
131
|
audioOptions.attachmentId = matches[1];
|
|
136
132
|
}
|
|
@@ -163,8 +159,7 @@ export function getContentFromElement($element, editor) {
|
|
|
163
159
|
const content = asLink($element, editor) || asImageEmbed($element) || asVideoElement($element) || asText($element, editor) || asNone($element);
|
|
164
160
|
return content;
|
|
165
161
|
}
|
|
166
|
-
export function getContentFromEditor(editor) {
|
|
167
|
-
let expandSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
162
|
+
export function getContentFromEditor(editor, expandSelection = false) {
|
|
168
163
|
let $element;
|
|
169
164
|
if (editor && editor.selection) {
|
|
170
165
|
// tinymce selects the element around the cursor, whether it's
|
|
@@ -194,18 +189,17 @@ export function isImageEmbed($element) {
|
|
|
194
189
|
return !!asImageEmbed($element) && !$element.getAttribute('data-placeholder-for');
|
|
195
190
|
}
|
|
196
191
|
function isMediaElement($element, mediaType) {
|
|
197
|
-
var _tinymceIframeShim$fi, _tinymceIframeShim$ge;
|
|
198
192
|
// the video is hosted in an iframe, but tinymce
|
|
199
193
|
// wraps it in a span with swizzled attribute names
|
|
200
|
-
if (
|
|
194
|
+
if (!$element?.getAttribute || !$element) {
|
|
201
195
|
return false;
|
|
202
196
|
}
|
|
203
197
|
const tinymceIframeShim = $element.tagName === 'IFRAME' ? $element.parentElement : $element;
|
|
204
|
-
if (
|
|
198
|
+
if (tinymceIframeShim.firstElementChild?.tagName !== 'IFRAME') {
|
|
205
199
|
return false;
|
|
206
200
|
}
|
|
207
201
|
const media_obj_id = tinymceIframeShim.getAttribute('data-mce-p-data-media-id');
|
|
208
|
-
const is_media_attachment_iframe =
|
|
202
|
+
const is_media_attachment_iframe = tinymceIframeShim.getAttribute('data-mce-p-src')?.includes('media_attachments_iframe');
|
|
209
203
|
if (!media_obj_id && !is_media_attachment_iframe) {
|
|
210
204
|
return false;
|
|
211
205
|
}
|
|
@@ -219,20 +213,18 @@ export function isAudioElement($element) {
|
|
|
219
213
|
return isMediaElement($element, 'audio');
|
|
220
214
|
}
|
|
221
215
|
export function findMediaPlayerIframe(elem) {
|
|
222
|
-
var _elem$firstElementChi;
|
|
223
216
|
if (!elem) return null;
|
|
224
217
|
if (elem.tagName === 'IFRAME') {
|
|
225
218
|
// we have the iframe
|
|
226
219
|
return elem;
|
|
227
220
|
}
|
|
228
|
-
if (
|
|
221
|
+
if (elem.firstElementChild?.tagName === 'IFRAME') {
|
|
229
222
|
// we have the shim tinymce puts around the iframe
|
|
230
223
|
return elem.firstElementChild;
|
|
231
224
|
}
|
|
232
225
|
if (elem.classList.contains('mce-shim')) {
|
|
233
|
-
var _elem$previousSibling;
|
|
234
226
|
// tinymce puts a <span class='mce-shin'> after the iframe (since v5, I think)
|
|
235
|
-
if (
|
|
227
|
+
if (elem.previousSibling?.tagName === 'IFRAME') {
|
|
236
228
|
return elem.previousSibling;
|
|
237
229
|
}
|
|
238
230
|
}
|
|
@@ -35,8 +35,7 @@ function scaleEvenly(width, height, scaleFactor, constraints) {
|
|
|
35
35
|
width: Math.round(width * minimumScaleFactor)
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
export function scaleForHeight(width, height, targetHeight) {
|
|
39
|
-
let constraints = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
38
|
+
export function scaleForHeight(width, height, targetHeight, constraints = {}) {
|
|
40
39
|
if (targetHeight == null) {
|
|
41
40
|
return {
|
|
42
41
|
height: null,
|
|
@@ -46,8 +45,7 @@ export function scaleForHeight(width, height, targetHeight) {
|
|
|
46
45
|
const scaleFactor = targetHeight / height;
|
|
47
46
|
return scaleEvenly(width, height, scaleFactor, constraints);
|
|
48
47
|
}
|
|
49
|
-
export function scaleForWidth(width, height, targetWidth) {
|
|
50
|
-
let constraints = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
48
|
+
export function scaleForWidth(width, height, targetWidth, constraints = {}) {
|
|
51
49
|
if (targetWidth == null) {
|
|
52
50
|
return {
|
|
53
51
|
height: null,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// Assumes we've already confirmed that cbdata includes files
|
|
22
22
|
export function isMicrosoftWordContentInEvent(event) {
|
|
23
23
|
const cbdata = event.type === 'paste' ? event.clipboardData : event.dataTransfer;
|
|
24
|
-
if (
|
|
24
|
+
if (cbdata?.files[0].type.indexOf('image/') === 0 && cbdata.types.includes('text/html')) {
|
|
25
25
|
const html = cbdata.getData('text/html');
|
|
26
26
|
return isMicrosoftWordContent(html);
|
|
27
27
|
}
|
|
@@ -48,20 +48,19 @@ function renderJoinedItem(bodyAs, renderBody, renderFooter) {
|
|
|
48
48
|
borderWidth: "small none none none"
|
|
49
49
|
}, renderFooter()))));
|
|
50
50
|
}
|
|
51
|
-
export const FixedContentTray =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref;
|
|
51
|
+
export const FixedContentTray = ({
|
|
52
|
+
title,
|
|
53
|
+
isOpen,
|
|
54
|
+
onDismiss,
|
|
55
|
+
onUnmount,
|
|
56
|
+
mountNode,
|
|
57
|
+
renderHeader,
|
|
58
|
+
renderBody,
|
|
59
|
+
renderFooter,
|
|
60
|
+
bodyAs,
|
|
61
|
+
shouldJoinBodyAndFooter,
|
|
62
|
+
shouldCloseOnDocumentClick
|
|
63
|
+
}) => {
|
|
65
64
|
return /*#__PURE__*/React.createElement(Tray, {
|
|
66
65
|
"data-mce-component": true,
|
|
67
66
|
label: title,
|
|
@@ -42,10 +42,9 @@ const directionToWord = direction => {
|
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
export const DirectionRegion =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} = _ref;
|
|
45
|
+
export const DirectionRegion = ({
|
|
46
|
+
direction
|
|
47
|
+
}) => {
|
|
49
48
|
const directionWord = directionToWord(direction);
|
|
50
49
|
const directionMessage = directionWord ? formatMessage('Moving image to crop {directionWord}', {
|
|
51
50
|
directionWord
|
|
@@ -29,7 +29,7 @@ import { Preview } from './Preview';
|
|
|
29
29
|
import { Controls } from './controls';
|
|
30
30
|
import { ImageCropperSettingsPropTypes } from './propTypes';
|
|
31
31
|
import { DirectionRegion } from './DirectionRegion';
|
|
32
|
-
import {
|
|
32
|
+
import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
|
|
33
33
|
const renderBody = (image, settings, dispatch, message, loading) => {
|
|
34
34
|
if (loading) {
|
|
35
35
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
@@ -73,17 +73,16 @@ const renderFooter = (settings, onClose) => {
|
|
|
73
73
|
type: "submit"
|
|
74
74
|
}, formatMessage('Save')));
|
|
75
75
|
};
|
|
76
|
-
export const ImageCropperModal =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} = _ref;
|
|
76
|
+
export const ImageCropperModal = ({
|
|
77
|
+
open,
|
|
78
|
+
shape,
|
|
79
|
+
onClose,
|
|
80
|
+
onSubmit,
|
|
81
|
+
image,
|
|
82
|
+
message,
|
|
83
|
+
cropSettings,
|
|
84
|
+
loading
|
|
85
|
+
}) => {
|
|
87
86
|
const [settings, dispatch] = useReducer(cropperSettingsReducer, defaultState);
|
|
88
87
|
useEffect(() => {
|
|
89
88
|
shape !== settings.shape && dispatch({
|
|
@@ -102,7 +101,7 @@ export const ImageCropperModal = _ref => {
|
|
|
102
101
|
"data-mce-component": true,
|
|
103
102
|
as: "form",
|
|
104
103
|
label: formatMessage('Crop Image'),
|
|
105
|
-
mountNode:
|
|
104
|
+
mountNode: instuiPopupMountNodeFn,
|
|
106
105
|
size: "large",
|
|
107
106
|
open: open,
|
|
108
107
|
onDismiss: onClose,
|
|
@@ -37,13 +37,12 @@ function replaceSvg(svg, node) {
|
|
|
37
37
|
}
|
|
38
38
|
node.appendChild(svg);
|
|
39
39
|
}
|
|
40
|
-
function getTransformValue(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = _ref;
|
|
40
|
+
function getTransformValue({
|
|
41
|
+
translateX,
|
|
42
|
+
translateY,
|
|
43
|
+
rotation,
|
|
44
|
+
scaleRatio
|
|
45
|
+
}) {
|
|
47
46
|
const values = [];
|
|
48
47
|
if (translateX !== 0) values.push(`translateX(${translateX}px)`);
|
|
49
48
|
if (translateY !== 0) values.push(`translateY(${translateY}px)`);
|
|
@@ -51,12 +50,11 @@ function getTransformValue(_ref) {
|
|
|
51
50
|
if (scaleRatio > 1) values.push(`scale(${scaleRatio})`);
|
|
52
51
|
return values.join(' ');
|
|
53
52
|
}
|
|
54
|
-
export const Preview =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref2;
|
|
53
|
+
export const Preview = ({
|
|
54
|
+
image,
|
|
55
|
+
settings,
|
|
56
|
+
dispatch
|
|
57
|
+
}) => {
|
|
60
58
|
const previewRef = /*#__PURE__*/createRef();
|
|
61
59
|
const shapeRef = /*#__PURE__*/createRef();
|
|
62
60
|
const imgRef = /*#__PURE__*/createRef();
|
|
@@ -22,15 +22,14 @@ import { NumberInput } from '@instructure/ui-number-input';
|
|
|
22
22
|
import { useDebouncedNumericValue } from './useDebouncedNumericValue';
|
|
23
23
|
import formatMessage from '../../../../../format-message';
|
|
24
24
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
25
|
-
export const CustomNumberInput =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} = _ref;
|
|
25
|
+
export const CustomNumberInput = ({
|
|
26
|
+
value,
|
|
27
|
+
parseValueCallback,
|
|
28
|
+
processValueCallback,
|
|
29
|
+
formatValueCallback,
|
|
30
|
+
placeholder,
|
|
31
|
+
onChange
|
|
32
|
+
}) => {
|
|
34
33
|
const [inputValue, digestCurrentValue, digestNewValue, hasError] = useDebouncedNumericValue({
|
|
35
34
|
value,
|
|
36
35
|
parseValueCallback,
|
|
@@ -22,10 +22,9 @@ import { Flex } from '@instructure/ui-flex';
|
|
|
22
22
|
import { Button } from '@instructure/ui-buttons';
|
|
23
23
|
import { IconResetLine } from '@instructure/ui-icons';
|
|
24
24
|
import formatMessage from '../../../../../format-message';
|
|
25
|
-
export const ResetControls =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
25
|
+
export const ResetControls = ({
|
|
26
|
+
onReset
|
|
27
|
+
}) => {
|
|
29
28
|
return /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
30
29
|
renderIcon: IconResetLine,
|
|
31
30
|
onClick: onReset
|
|
@@ -39,11 +39,10 @@ const parseRotationText = value => {
|
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
41
|
const formatRotationText = value => `${value}º`;
|
|
42
|
-
export const RotationControls =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = _ref;
|
|
42
|
+
export const RotationControls = ({
|
|
43
|
+
rotation,
|
|
44
|
+
onChange
|
|
45
|
+
}) => {
|
|
47
46
|
const rotateLeftCallback = () => onChange(calculateRotation(getNearestRectAngle(rotation, true) - BUTTON_ROTATION_DEGREES));
|
|
48
47
|
const rotateRightCallback = () => onChange(calculateRotation(getNearestRectAngle(rotation, false) + BUTTON_ROTATION_DEGREES));
|
|
49
48
|
return /*#__PURE__*/React.createElement(Flex.Item, {
|
|
@@ -49,22 +49,18 @@ const SHAPE_OPTIONS = [{
|
|
|
49
49
|
id: Shape.Star,
|
|
50
50
|
label: formatMessage('Star')
|
|
51
51
|
}];
|
|
52
|
-
export const ShapeControls =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} = _ref;
|
|
52
|
+
export const ShapeControls = ({
|
|
53
|
+
shape,
|
|
54
|
+
onChange
|
|
55
|
+
}) => {
|
|
57
56
|
return /*#__PURE__*/React.createElement(Flex.Item, {
|
|
58
57
|
margin: "0 medium 0 0"
|
|
59
58
|
}, /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
60
59
|
isInline: true,
|
|
61
60
|
value: shape,
|
|
62
|
-
onChange: (event,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} = _ref2;
|
|
66
|
-
return onChange(id);
|
|
67
|
-
},
|
|
61
|
+
onChange: (event, {
|
|
62
|
+
id
|
|
63
|
+
}) => onChange(id),
|
|
68
64
|
renderLabel: /*#__PURE__*/React.createElement(ScreenReaderContent, null, formatMessage('Select crop shape')),
|
|
69
65
|
"data-testid": "shape-select-dropdown"
|
|
70
66
|
}, SHAPE_OPTIONS.map(option => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
@@ -43,11 +43,10 @@ const parseZoomText = value => {
|
|
|
43
43
|
};
|
|
44
44
|
const formatZoomText = value => `${value}%`;
|
|
45
45
|
const debouncedAlert = debounce(showFlashAlert, 1000);
|
|
46
|
-
export const ZoomControls =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref;
|
|
46
|
+
export const ZoomControls = ({
|
|
47
|
+
scaleRatio,
|
|
48
|
+
onChange
|
|
49
|
+
}) => {
|
|
51
50
|
const onZoomChange = value => {
|
|
52
51
|
const message = {
|
|
53
52
|
message: `${round(value * 100)}% Zoom`,
|
|
@@ -23,11 +23,10 @@ import { ZoomControls } from './ZoomControls';
|
|
|
23
23
|
import { RotationControls } from './RotationControls';
|
|
24
24
|
import { ShapeControls } from './ShapeControls';
|
|
25
25
|
import { ResetControls } from './ResetControls';
|
|
26
|
-
export const Controls =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
26
|
+
export const Controls = ({
|
|
27
|
+
settings,
|
|
28
|
+
dispatch
|
|
29
|
+
}) => {
|
|
31
30
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
32
31
|
id: "imageCropperControls",
|
|
33
32
|
direction: "row",
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
import { useEffect, useRef, useState } from 'react';
|
|
20
20
|
import { debounce } from '@instructure/debounce';
|
|
21
21
|
const CHANGE_EVENT_DELAY = 1000;
|
|
22
|
-
const digestValue =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
22
|
+
const digestValue = ({
|
|
23
|
+
parseValueCallback,
|
|
24
|
+
processValueCallback,
|
|
25
|
+
formatValueCallback,
|
|
26
|
+
value
|
|
27
|
+
}) => {
|
|
29
28
|
const parsedNewValue = parseValueCallback(value);
|
|
30
29
|
if (parsedNewValue === null) {
|
|
31
30
|
return [null, null];
|
|
@@ -34,14 +33,13 @@ const digestValue = _ref => {
|
|
|
34
33
|
const formattedNewTempValue = formatValueCallback(processedNewValue);
|
|
35
34
|
return [formattedNewTempValue, processedNewValue];
|
|
36
35
|
};
|
|
37
|
-
export function useDebouncedNumericValue(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = _ref2;
|
|
36
|
+
export function useDebouncedNumericValue({
|
|
37
|
+
value,
|
|
38
|
+
parseValueCallback,
|
|
39
|
+
processValueCallback,
|
|
40
|
+
formatValueCallback,
|
|
41
|
+
onChange
|
|
42
|
+
}) {
|
|
45
43
|
const [inputValue, setInputValue] = useState(formatValueCallback(value));
|
|
46
44
|
const [hasError, setHasError] = useState(false);
|
|
47
45
|
const updateStateAfterDigest = newValue => {
|
|
@@ -62,11 +62,10 @@ const fetchImageMetadata = src => {
|
|
|
62
62
|
img.src = src;
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
|
-
const createDefsElement =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} = _ref;
|
|
65
|
+
const createDefsElement = ({
|
|
66
|
+
shape,
|
|
67
|
+
squareDimension
|
|
68
|
+
}) => {
|
|
70
69
|
const defs = createSvgElement('defs');
|
|
71
70
|
const shapeMask = buildShapeMask({
|
|
72
71
|
shape,
|
|
@@ -82,14 +81,13 @@ const createDefsElement = _ref => {
|
|
|
82
81
|
const convertTranslationUnits = (translationPixels, imageHeight) => {
|
|
83
82
|
return imageHeight * translationPixels / PREVIEW_HEIGHT;
|
|
84
83
|
};
|
|
85
|
-
const createMainSvgGroup =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} = _ref2;
|
|
84
|
+
const createMainSvgGroup = ({
|
|
85
|
+
imageWidth,
|
|
86
|
+
imageHeight,
|
|
87
|
+
squareDimension,
|
|
88
|
+
image,
|
|
89
|
+
settings
|
|
90
|
+
}) => {
|
|
93
91
|
const mainGroup = createSvgElement('g', {
|
|
94
92
|
'clip-path': `url(#${CLIP_PATH_ID})`
|
|
95
93
|
});
|
|
@@ -108,14 +106,13 @@ const createMainSvgGroup = _ref2 => {
|
|
|
108
106
|
mainGroup.appendChild(imageElement);
|
|
109
107
|
return mainGroup;
|
|
110
108
|
};
|
|
111
|
-
export const setTransformAttribute =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
} = _ref3;
|
|
109
|
+
export const setTransformAttribute = ({
|
|
110
|
+
imageElement,
|
|
111
|
+
imageWidth,
|
|
112
|
+
imageHeight,
|
|
113
|
+
squareDimension,
|
|
114
|
+
settings
|
|
115
|
+
}) => {
|
|
119
116
|
const {
|
|
120
117
|
rotation = 0,
|
|
121
118
|
scaleRatio = 1.0,
|
|
@@ -20,11 +20,10 @@ import round from '../../round';
|
|
|
20
20
|
import { SHAPE_CONTAINER_LENGTH } from '../constants';
|
|
21
21
|
import { createSvgElement } from './utils';
|
|
22
22
|
import { Shape } from '../shape';
|
|
23
|
-
export function buildShapeMask(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
23
|
+
export function buildShapeMask({
|
|
24
|
+
shape,
|
|
25
|
+
size
|
|
26
|
+
}) {
|
|
28
27
|
const dimensionSize = size || SHAPE_CONTAINER_LENGTH;
|
|
29
28
|
switch (shape) {
|
|
30
29
|
case Shape.Square:
|
|
@@ -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;
|
|
@@ -73,10 +73,7 @@ function useKeysEvents(tempTranslateXRef, tempTranslateYRef, tempTranslateX, tem
|
|
|
73
73
|
useEffect(() => {
|
|
74
74
|
const onKeyDownWrapper = event => {
|
|
75
75
|
// If the active element is in the modal header, footer or controls.
|
|
76
|
-
if (EVENT_EXCEPTION_ELEMENT_IDS.some(id => {
|
|
77
|
-
var _document$getElementB;
|
|
78
|
-
return (_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.contains(document.activeElement);
|
|
79
|
-
})) {
|
|
76
|
+
if (EVENT_EXCEPTION_ELEMENT_IDS.some(id => document.getElementById(id)?.contains(document.activeElement))) {
|
|
80
77
|
return;
|
|
81
78
|
}
|
|
82
79
|
onKeyDown(event);
|