@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
|
@@ -28,9 +28,9 @@ import { performTextEditActionOnTextarea } from '../../../../util/textarea-editi
|
|
|
28
28
|
*/
|
|
29
29
|
export function insertTextIntoLatexTextarea(textarea, insertionText) {
|
|
30
30
|
var _textarea$value, _textarea$selectionSt, _textarea$selectionEn;
|
|
31
|
-
const currentText = (_textarea$value = textarea
|
|
32
|
-
const selStart = (_textarea$selectionSt = textarea
|
|
33
|
-
const selEnd = (_textarea$selectionEn = textarea
|
|
31
|
+
const currentText = (_textarea$value = textarea?.value) !== null && _textarea$value !== void 0 ? _textarea$value : '';
|
|
32
|
+
const selStart = (_textarea$selectionSt = textarea?.selectionStart) !== null && _textarea$selectionSt !== void 0 ? _textarea$selectionSt : currentText.length;
|
|
33
|
+
const selEnd = (_textarea$selectionEn = textarea?.selectionEnd) !== null && _textarea$selectionEn !== void 0 ? _textarea$selectionEn : selStart;
|
|
34
34
|
textarea.focus();
|
|
35
35
|
planInsertTextIntoLatexTextarea({
|
|
36
36
|
insertionText,
|
|
@@ -48,8 +48,8 @@ export const parseLatex = editor => {
|
|
|
48
48
|
const selection = editor.selection.getContent();
|
|
49
49
|
const selectionNode = editor.selection.getNode();
|
|
50
50
|
const editorRange = editor.selection.getRng();
|
|
51
|
-
const startContainer = editorRange
|
|
52
|
-
const wholeText = startContainer
|
|
51
|
+
const startContainer = editorRange?.startContainer;
|
|
52
|
+
const wholeText = startContainer?.wholeText;
|
|
53
53
|
|
|
54
54
|
// check if selection is inline latex
|
|
55
55
|
if (selection && selectionIsLatex(selection)) {
|
|
@@ -58,7 +58,7 @@ export const parseLatex = editor => {
|
|
|
58
58
|
latex,
|
|
59
59
|
advancedOnly: containsAdvancedSyntax(latex)
|
|
60
60
|
};
|
|
61
|
-
} else if (
|
|
61
|
+
} else if (selectionNode?.tagName === 'IMG' && selectionNode?.classList.contains('equation_image')) {
|
|
62
62
|
// check if we launched modal from an equation image
|
|
63
63
|
try {
|
|
64
64
|
const src = new URL(selectionNode.src);
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
import formatMessage from '../../../../format-message';
|
|
20
|
+
export default [{
|
|
21
21
|
name: formatMessage('Basic'),
|
|
22
22
|
commands: [{
|
|
23
23
|
displayName: 'x_{\u2B1A}^{\\ }',
|
|
@@ -29,10 +29,9 @@ const buttonContainerStyle = {
|
|
|
29
29
|
};
|
|
30
30
|
function EquationEditorToolbar(props) {
|
|
31
31
|
const [selectedTab, setSelectedTab] = useState('Basic');
|
|
32
|
-
const handleTabChange = (event,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
32
|
+
const handleTabChange = (event, {
|
|
33
|
+
index
|
|
34
|
+
}) => {
|
|
36
35
|
setSelectedTab(buttons[index].name);
|
|
37
36
|
};
|
|
38
37
|
const renderTabPanel = section => /*#__PURE__*/React.createElement(Tabs.Panel, {
|
|
@@ -41,13 +40,12 @@ function EquationEditorToolbar(props) {
|
|
|
41
40
|
padding: "small small",
|
|
42
41
|
renderTitle: section.name,
|
|
43
42
|
isSelected: selectedTab === section.name
|
|
44
|
-
}, section.commands.map(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref2;
|
|
43
|
+
}, section.commands.map(({
|
|
44
|
+
displayName,
|
|
45
|
+
command,
|
|
46
|
+
advancedCommand,
|
|
47
|
+
label
|
|
48
|
+
}) => {
|
|
51
49
|
const name = displayName || command;
|
|
52
50
|
const icon = /*#__PURE__*/React.createElement(MathIcon, {
|
|
53
51
|
command: command
|
|
@@ -21,10 +21,9 @@ import { string } from 'prop-types';
|
|
|
21
21
|
import { IconWarningLine } from '@instructure/ui-icons';
|
|
22
22
|
import { SVGIcon } from '@instructure/ui-svg-images';
|
|
23
23
|
import svgs from './svgs';
|
|
24
|
-
export default function MathIcon(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
24
|
+
export default function MathIcon({
|
|
25
|
+
command
|
|
26
|
+
}) {
|
|
28
27
|
if (command in svgs) {
|
|
29
28
|
return /*#__PURE__*/React.createElement(SVGIcon, {
|
|
30
29
|
src: svgs[command],
|
|
@@ -1,22 +1,173 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
* Copyright (c) 2017 - present Arno Gourdol. All rights reserved.
|
|
3
|
+
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
5
|
+
* copy of this software and associated documentation files (the "Software"),
|
|
6
|
+
* to deal in the Software without restriction, including without limitation
|
|
7
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
8
|
+
* and/or sell copies of the Software, and to permit persons to whom the
|
|
9
|
+
* Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
19
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
* DEALINGS IN THE SOFTWARE.
|
|
17
21
|
*/
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
// TODO: restore import after switch from webpack to rslib
|
|
24
|
+
// import mathliveCss from 'mathlive/dist/mathlive-fonts.css'
|
|
25
|
+
|
|
26
|
+
const mathliveCss = `
|
|
27
|
+
@font-face {
|
|
28
|
+
font-display: "swap";
|
|
29
|
+
font-family: KaTeX_AMS;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
src: url(fonts/KaTeX_AMS-Regular.woff2) format("woff2");
|
|
33
|
+
}
|
|
34
|
+
@font-face {
|
|
35
|
+
font-display: "swap";
|
|
36
|
+
font-family: KaTeX_Caligraphic;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: 700;
|
|
39
|
+
src: url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2");
|
|
40
|
+
}
|
|
41
|
+
@font-face {
|
|
42
|
+
font-display: "swap";
|
|
43
|
+
font-family: KaTeX_Caligraphic;
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
src: url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2");
|
|
47
|
+
}
|
|
48
|
+
@font-face {
|
|
49
|
+
font-display: "swap";
|
|
50
|
+
font-family: KaTeX_Fraktur;
|
|
51
|
+
font-style: normal;
|
|
52
|
+
font-weight: 700;
|
|
53
|
+
src: url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2");
|
|
54
|
+
}
|
|
55
|
+
@font-face {
|
|
56
|
+
font-display: "swap";
|
|
57
|
+
font-family: KaTeX_Fraktur;
|
|
58
|
+
font-style: normal;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
src: url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2");
|
|
61
|
+
}
|
|
62
|
+
@font-face {
|
|
63
|
+
font-display: "swap";
|
|
64
|
+
font-family: KaTeX_Main;
|
|
65
|
+
font-style: italic;
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
src: url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2");
|
|
68
|
+
}
|
|
69
|
+
@font-face {
|
|
70
|
+
font-display: "swap";
|
|
71
|
+
font-family: KaTeX_Main;
|
|
72
|
+
font-style: normal;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
src: url(fonts/KaTeX_Main-Bold.woff2) format("woff2");
|
|
75
|
+
}
|
|
76
|
+
@font-face {
|
|
77
|
+
font-display: "swap";
|
|
78
|
+
font-family: KaTeX_Main;
|
|
79
|
+
font-style: italic;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
src: url(fonts/KaTeX_Main-Italic.woff2) format("woff2");
|
|
82
|
+
}
|
|
83
|
+
@font-face {
|
|
84
|
+
font-display: "swap";
|
|
85
|
+
font-family: KaTeX_Main;
|
|
86
|
+
font-style: normal;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
src: url(fonts/KaTeX_Main-Regular.woff2) format("woff2");
|
|
89
|
+
}
|
|
90
|
+
@font-face {
|
|
91
|
+
font-display: "swap";
|
|
92
|
+
font-family: KaTeX_Math;
|
|
93
|
+
font-style: italic;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
src: url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2");
|
|
96
|
+
}
|
|
97
|
+
@font-face {
|
|
98
|
+
font-display: "swap";
|
|
99
|
+
font-family: KaTeX_Math;
|
|
100
|
+
font-style: italic;
|
|
101
|
+
font-weight: 400;
|
|
102
|
+
src: url(fonts/KaTeX_Math-Italic.woff2) format("woff2");
|
|
103
|
+
}
|
|
104
|
+
@font-face {
|
|
105
|
+
font-display: "swap";
|
|
106
|
+
font-family: "KaTeX_SansSerif";
|
|
107
|
+
font-style: normal;
|
|
108
|
+
font-weight: 700;
|
|
109
|
+
src: url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2");
|
|
110
|
+
}
|
|
111
|
+
@font-face {
|
|
112
|
+
font-display: "swap";
|
|
113
|
+
font-family: "KaTeX_SansSerif";
|
|
114
|
+
font-style: italic;
|
|
115
|
+
font-weight: 400;
|
|
116
|
+
src: url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2");
|
|
117
|
+
}
|
|
118
|
+
@font-face {
|
|
119
|
+
font-display: "swap";
|
|
120
|
+
font-family: "KaTeX_SansSerif";
|
|
121
|
+
font-style: normal;
|
|
122
|
+
font-weight: 400;
|
|
123
|
+
src: url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2");
|
|
124
|
+
}
|
|
125
|
+
@font-face {
|
|
126
|
+
font-display: "swap";
|
|
127
|
+
font-family: KaTeX_Script;
|
|
128
|
+
font-style: normal;
|
|
129
|
+
font-weight: 400;
|
|
130
|
+
src: url(fonts/KaTeX_Script-Regular.woff2) format("woff2");
|
|
131
|
+
}
|
|
132
|
+
@font-face {
|
|
133
|
+
font-display: "swap";
|
|
134
|
+
font-family: KaTeX_Size1;
|
|
135
|
+
font-style: normal;
|
|
136
|
+
font-weight: 400;
|
|
137
|
+
src: url(fonts/KaTeX_Size1-Regular.woff2) format("woff2");
|
|
138
|
+
}
|
|
139
|
+
@font-face {
|
|
140
|
+
font-display: "swap";
|
|
141
|
+
font-family: KaTeX_Size2;
|
|
142
|
+
font-style: normal;
|
|
143
|
+
font-weight: 400;
|
|
144
|
+
src: url(fonts/KaTeX_Size2-Regular.woff2) format("woff2");
|
|
145
|
+
}
|
|
146
|
+
@font-face {
|
|
147
|
+
font-display: "swap";
|
|
148
|
+
font-family: KaTeX_Size3;
|
|
149
|
+
font-style: normal;
|
|
150
|
+
font-weight: 400;
|
|
151
|
+
src: url(fonts/KaTeX_Size3-Regular.woff2) format("woff2");
|
|
152
|
+
}
|
|
153
|
+
@font-face {
|
|
154
|
+
font-display: "swap";
|
|
155
|
+
font-family: KaTeX_Size4;
|
|
156
|
+
font-style: normal;
|
|
157
|
+
font-weight: 400;
|
|
158
|
+
src: url(fonts/KaTeX_Size4-Regular.woff2) format("woff2");
|
|
159
|
+
}
|
|
160
|
+
@font-face {
|
|
161
|
+
font-display: "swap";
|
|
162
|
+
font-family: KaTeX_Typewriter;
|
|
163
|
+
font-style: normal;
|
|
164
|
+
font-weight: 400;
|
|
165
|
+
src: url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2");
|
|
166
|
+
}
|
|
167
|
+
:root {
|
|
168
|
+
--ML__static-fonts: true;
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
20
171
|
const cssRules = `.ML__popover {
|
|
21
172
|
/* Override this so it shows up on top of dialogs */
|
|
22
173
|
z-index: 20000 !important;
|
|
@@ -29,7 +29,6 @@ tinymce.PluginManager.add('instructure_fullscreen', function (editor) {
|
|
|
29
29
|
icon: 'fullscreen',
|
|
30
30
|
onAction: () => editor.execCommand('instructureFullscreen'),
|
|
31
31
|
onSetup(api) {
|
|
32
|
-
// @ts-expect-error
|
|
33
32
|
api.setDisabled(!!document[FS_ELEMENT]);
|
|
34
33
|
return () => undefined;
|
|
35
34
|
}
|
|
@@ -39,7 +38,6 @@ tinymce.PluginManager.add('instructure_fullscreen', function (editor) {
|
|
|
39
38
|
icon: 'fullscreen_exit',
|
|
40
39
|
onAction: () => editor.execCommand('instructureFullscreen'),
|
|
41
40
|
onSetup(api) {
|
|
42
|
-
// @ts-expect-error
|
|
43
41
|
api.setDisabled(!document[FS_ELEMENT]);
|
|
44
42
|
return () => undefined;
|
|
45
43
|
}
|
|
@@ -25,10 +25,9 @@ export const LIST_ICON_MAKER = 'list_icon_maker_icons';
|
|
|
25
25
|
export const EDIT_ICON_MAKER = 'edit_icon_maker_icon';
|
|
26
26
|
export const ICONS_TRAY_CONTAINER_ID = 'instructure-rce-icons-tray-container';
|
|
27
27
|
export default function (ed, document, type) {
|
|
28
|
-
return import('./components/IconMakerTray').then(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
28
|
+
return import('./components/IconMakerTray').then(({
|
|
29
|
+
IconMakerTray
|
|
30
|
+
}) => {
|
|
32
31
|
let container = document.querySelector(`#${ICONS_TRAY_CONTAINER_ID}`);
|
|
33
32
|
const trayProps = bridge.trayProps.get(ed);
|
|
34
33
|
const handleUnmount = () => {
|
package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ColorSection.js
CHANGED
|
@@ -24,55 +24,52 @@ import formatMessage from '../../../../../format-message';
|
|
|
24
24
|
const OUTLINE_SIZES = ['none', 'small', 'medium', 'large'];
|
|
25
25
|
export const COLOR_SECTION_ID = 'icons-tray-color-section';
|
|
26
26
|
const getColorSection = () => document.querySelector(`#${COLOR_SECTION_ID}`);
|
|
27
|
-
export const ColorSection =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
requireColor: true
|
|
74
|
-
})));
|
|
75
|
-
};
|
|
27
|
+
export const ColorSection = ({
|
|
28
|
+
settings,
|
|
29
|
+
onChange
|
|
30
|
+
}) => /*#__PURE__*/React.createElement(Flex, {
|
|
31
|
+
as: "section",
|
|
32
|
+
direction: "column",
|
|
33
|
+
id: COLOR_SECTION_ID,
|
|
34
|
+
justifyItems: "space-between",
|
|
35
|
+
padding: "0 small"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Flex.Item, {
|
|
37
|
+
padding: "small"
|
|
38
|
+
}, /*#__PURE__*/React.createElement(ColorInput, {
|
|
39
|
+
color: settings.color,
|
|
40
|
+
label: formatMessage('Icon Color'),
|
|
41
|
+
name: "icon-color",
|
|
42
|
+
onChange: color => onChange({
|
|
43
|
+
color
|
|
44
|
+
}),
|
|
45
|
+
popoverMountNode: getColorSection
|
|
46
|
+
})), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
47
|
+
padding: "small"
|
|
48
|
+
}, /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
49
|
+
assistiveText: formatMessage('Use arrow keys to select an outline size.'),
|
|
50
|
+
id: "icon-outline-size",
|
|
51
|
+
mountNode: getColorSection,
|
|
52
|
+
onChange: (e, option) => onChange({
|
|
53
|
+
outlineSize: option.value
|
|
54
|
+
}),
|
|
55
|
+
renderLabel: formatMessage('Outline Size'),
|
|
56
|
+
value: settings.outlineSize
|
|
57
|
+
}, OUTLINE_SIZES.map(size => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
58
|
+
id: `outline-size-${size}`,
|
|
59
|
+
key: `outline-size-${size}`,
|
|
60
|
+
value: size
|
|
61
|
+
}, OUTLINE_SIZE_DESCRIPTION[size] || '')))), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
62
|
+
padding: "small"
|
|
63
|
+
}, /*#__PURE__*/React.createElement(ColorInput, {
|
|
64
|
+
color: settings.outlineColor,
|
|
65
|
+
label: formatMessage('Outline Color'),
|
|
66
|
+
name: "icon-outline",
|
|
67
|
+
onChange: outlineColor => onChange({
|
|
68
|
+
outlineColor
|
|
69
|
+
}),
|
|
70
|
+
popoverMountNode: getColorSection,
|
|
71
|
+
requireColor: true
|
|
72
|
+
})));
|
|
76
73
|
const OUTLINE_SIZE_DESCRIPTION = {
|
|
77
74
|
none: formatMessage('None'),
|
|
78
75
|
small: formatMessage('Small'),
|
package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/CreateIconMakerForm.js
CHANGED
|
@@ -22,16 +22,15 @@ import { ShapeSection } from './ShapeSection';
|
|
|
22
22
|
import { ColorSection } from './ColorSection';
|
|
23
23
|
import { TextSection } from './TextSection';
|
|
24
24
|
import { ImageSection } from './ImageSection';
|
|
25
|
-
export const CreateIconMakerForm =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = _ref;
|
|
25
|
+
export const CreateIconMakerForm = ({
|
|
26
|
+
settings,
|
|
27
|
+
dispatch,
|
|
28
|
+
editor,
|
|
29
|
+
editing,
|
|
30
|
+
allowNameChange,
|
|
31
|
+
nameRef,
|
|
32
|
+
canvasOrigin
|
|
33
|
+
}) => {
|
|
35
34
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
|
|
36
35
|
settings: settings,
|
|
37
36
|
onChange: dispatch,
|
|
@@ -23,17 +23,16 @@ import { Flex } from '@instructure/ui-flex';
|
|
|
23
23
|
import { View } from '@instructure/ui-view';
|
|
24
24
|
import formatMessage from '../../../../../format-message';
|
|
25
25
|
import { ConditionalTooltip } from '../../../shared/ConditionalTooltip';
|
|
26
|
-
export const Footer =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref;
|
|
26
|
+
export const Footer = ({
|
|
27
|
+
disabled,
|
|
28
|
+
onCancel,
|
|
29
|
+
onSubmit,
|
|
30
|
+
replaceAll,
|
|
31
|
+
onReplaceAllChanged,
|
|
32
|
+
editing,
|
|
33
|
+
isModified,
|
|
34
|
+
applyRef
|
|
35
|
+
}) => {
|
|
37
36
|
return /*#__PURE__*/React.createElement(React.Fragment, null, editing && /*#__PURE__*/React.createElement(View, {
|
|
38
37
|
as: "div",
|
|
39
38
|
padding: "medium"
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
import React from 'react';
|
|
20
20
|
import { ToggleGroup } from '@instructure/ui-toggle-details';
|
|
21
21
|
import formatMessage from '../../../../../format-message';
|
|
22
|
-
export function Group(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
22
|
+
export function Group({
|
|
23
|
+
children,
|
|
24
|
+
summary,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
28
27
|
return /*#__PURE__*/React.createElement(ToggleGroup, Object.assign({
|
|
29
28
|
background: "default",
|
|
30
29
|
border: false,
|
|
@@ -49,14 +49,13 @@ const getAltTextLabel = () => /*#__PURE__*/React.createElement(Flex, {
|
|
|
49
49
|
size: "small",
|
|
50
50
|
screenReaderLabel: formatMessage('Toggle tooltip')
|
|
51
51
|
}))));
|
|
52
|
-
export const Header =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref;
|
|
52
|
+
export const Header = ({
|
|
53
|
+
settings,
|
|
54
|
+
onChange,
|
|
55
|
+
allowNameChange,
|
|
56
|
+
nameRef,
|
|
57
|
+
editing
|
|
58
|
+
}) => {
|
|
60
59
|
const originalName = settings.originalName;
|
|
61
60
|
const [name, setName] = useDebouncedValue(settings.name, n => onChange({
|
|
62
61
|
name: n
|
package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js
CHANGED
|
@@ -63,7 +63,6 @@ const dispatchImage = async (dispatch, onChange, dataUrl, dataBlob) => {
|
|
|
63
63
|
previewHeight: PREVIEW_HEIGHT
|
|
64
64
|
});
|
|
65
65
|
} catch (e) {
|
|
66
|
-
// eslint-disable-next-line no-console
|
|
67
66
|
console.error(e);
|
|
68
67
|
}
|
|
69
68
|
dispatch({
|
|
@@ -80,14 +79,13 @@ const dispatchImage = async (dispatch, onChange, dataUrl, dataBlob) => {
|
|
|
80
79
|
payload: image
|
|
81
80
|
});
|
|
82
81
|
};
|
|
83
|
-
const Course =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} = _ref;
|
|
82
|
+
const Course = ({
|
|
83
|
+
dispatch,
|
|
84
|
+
onChange,
|
|
85
|
+
onLoading,
|
|
86
|
+
onLoaded,
|
|
87
|
+
canvasOrigin
|
|
88
|
+
}) => {
|
|
91
89
|
const storeProps = useStoreProps();
|
|
92
90
|
const {
|
|
93
91
|
files,
|
|
@@ -39,10 +39,9 @@ import _ from 'lodash';
|
|
|
39
39
|
const getCompressionMessage = () => formatMessage('Your image has been compressed for Icon Maker. Images less than {size} KB will not be compressed.', {
|
|
40
40
|
size: MAX_IMAGE_SIZE_BYTES / 1024
|
|
41
41
|
});
|
|
42
|
-
function renderImagePreview(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref;
|
|
42
|
+
function renderImagePreview({
|
|
43
|
+
loading
|
|
44
|
+
}, embedImage) {
|
|
46
45
|
return /*#__PURE__*/React.createElement(PreviewIcon, {
|
|
47
46
|
variant: "large",
|
|
48
47
|
testId: "selected-image-preview",
|
|
@@ -51,20 +50,18 @@ function renderImagePreview(_ref, embedImage) {
|
|
|
51
50
|
checkered: true
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
function renderImageName(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref2;
|
|
53
|
+
function renderImageName({
|
|
54
|
+
imageName
|
|
55
|
+
}) {
|
|
58
56
|
return /*#__PURE__*/React.createElement(View, {
|
|
59
57
|
maxWidth: "200px",
|
|
60
58
|
as: "div"
|
|
61
59
|
}, /*#__PURE__*/React.createElement(TruncateText, null, /*#__PURE__*/React.createElement(Text, null, imageName || formatMessage('None Selected'))));
|
|
62
60
|
}
|
|
63
|
-
function renderImageActionButtons(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref3;
|
|
61
|
+
function renderImageActionButtons({
|
|
62
|
+
mode,
|
|
63
|
+
collectionOpen
|
|
64
|
+
}, dispatch, trayDispatch, setFocus, ref) {
|
|
68
65
|
const showCropButton = [modes.uploadImages.type, modes.courseImages.type].includes(mode) && !collectionOpen;
|
|
69
66
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showCropButton && /*#__PURE__*/React.createElement(IconButton, {
|
|
70
67
|
margin: "0 small 0 0",
|
|
@@ -88,14 +85,13 @@ function renderImageActionButtons(_ref3, dispatch, trayDispatch, setFocus, ref)
|
|
|
88
85
|
"data-testid": "clear-image"
|
|
89
86
|
}, /*#__PURE__*/React.createElement(IconTrashLine, null)));
|
|
90
87
|
}
|
|
91
|
-
export const ImageOptions =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} = _ref4;
|
|
88
|
+
export const ImageOptions = ({
|
|
89
|
+
state,
|
|
90
|
+
settings,
|
|
91
|
+
dispatch,
|
|
92
|
+
mountNode,
|
|
93
|
+
trayDispatch
|
|
94
|
+
}) => {
|
|
99
95
|
const [isImageActionFocused, setIsImageActionFocused] = useState(false);
|
|
100
96
|
const imageActionRef = useCallback(el => {
|
|
101
97
|
if (el && isImageActionFocused) el.focus();
|
|
@@ -103,8 +99,7 @@ export const ImageOptions = _ref4 => {
|
|
|
103
99
|
|
|
104
100
|
// After submitting cropper modal a new embedded image should be generated
|
|
105
101
|
useEffect(() => {
|
|
106
|
-
|
|
107
|
-
if (state.cropperSettings && settings.imageSettings && !_.isEqual(state.cropperSettings, (_settings$imageSettin = settings.imageSettings) === null || _settings$imageSettin === void 0 ? void 0 : _settings$imageSettin.cropperSettings)) {
|
|
102
|
+
if (state.cropperSettings && settings.imageSettings && !_.isEqual(state.cropperSettings, settings.imageSettings?.cropperSettings)) {
|
|
108
103
|
if (state.cropperSettings.shape !== settings.shape) {
|
|
109
104
|
trayDispatch({
|
|
110
105
|
shape: state.cropperSettings.shape
|
|
@@ -117,9 +112,7 @@ export const ImageOptions = _ref4 => {
|
|
|
117
112
|
type: trayActions.SET_EMBED_IMAGE,
|
|
118
113
|
payload: base64Image
|
|
119
114
|
});
|
|
120
|
-
})
|
|
121
|
-
// eslint-disable-next-line no-console
|
|
122
|
-
.catch(error => console.error(error));
|
|
115
|
+
}).catch(error => console.error(error));
|
|
123
116
|
}
|
|
124
117
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125
118
|
}, [state.cropperSettings]);
|