@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
|
@@ -50,26 +50,21 @@ const localConfig = {
|
|
|
50
50
|
messageStyle: 'none'
|
|
51
51
|
};
|
|
52
52
|
class Mathml {
|
|
53
|
-
constructor() {
|
|
54
|
-
let features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
55
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
53
|
+
constructor(features = {}, config = {}) {
|
|
56
54
|
this._features = features;
|
|
57
55
|
this._config = config;
|
|
58
56
|
}
|
|
59
|
-
loadMathJax() {
|
|
60
|
-
let configFile = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'TeX-MML-AM_SVG';
|
|
61
|
-
let cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
57
|
+
loadMathJax(configFile = 'TeX-MML-AM_SVG', cb = null) {
|
|
62
58
|
if (this.preventMathJax()) {
|
|
63
59
|
return;
|
|
64
60
|
}
|
|
65
61
|
if (!this.isMathJaxLoaded()) {
|
|
66
|
-
var _this$_features, _this$_config;
|
|
67
62
|
// Statically declare this in the localConfig above as part of MAT-1219
|
|
68
|
-
if (
|
|
63
|
+
if (this._features?.explicit_latex_typesetting) {
|
|
69
64
|
localConfig.elements = document.getElementsByClassName(MathJaxDirective.Process);
|
|
70
65
|
localConfig.tex2jax.processClass = MathJaxDirective.Process;
|
|
71
66
|
}
|
|
72
|
-
const locale =
|
|
67
|
+
const locale = this._config?.locale || 'en';
|
|
73
68
|
// signal local config to mathjax as it loads
|
|
74
69
|
window.MathJax = localConfig;
|
|
75
70
|
if (window.MathJaxIsLoading) return;
|
|
@@ -82,31 +77,27 @@ class Mathml {
|
|
|
82
77
|
script.async = true;
|
|
83
78
|
script.src = `//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=${configFile}&locale=${locale}`;
|
|
84
79
|
});
|
|
85
|
-
// eslint-disable-next-line promise/catch-or-return
|
|
86
80
|
scriptPromise.then(() => {
|
|
87
|
-
var _this$_features2;
|
|
88
81
|
window.MathJax.Hub.Register.StartupHook('MathMenu Ready', function () {
|
|
89
82
|
// get the mathjax context menu above the rce's equation editor
|
|
90
83
|
window.MathJax.Menu.BGSTYLE['z-index'] = 2000;
|
|
91
84
|
});
|
|
92
85
|
window.MathJax.Hub.Register.StartupHook('End Config', function () {
|
|
93
86
|
// wait until MathJAx is configured before calling the callback
|
|
94
|
-
cb
|
|
87
|
+
cb?.();
|
|
95
88
|
});
|
|
96
|
-
if (
|
|
89
|
+
if (this._features?.new_math_equation_handling) {
|
|
97
90
|
window.MathJax.Hub.Register.MessageHook('Begin PreProcess', function (message) {
|
|
98
91
|
mathImageHelper.catchEquationImages(message[1]);
|
|
99
92
|
});
|
|
100
93
|
window.MathJax.Hub.Register.MessageHook('Math Processing Error', function (message) {
|
|
101
|
-
var _elem$parentElement;
|
|
102
94
|
const elem = Array.isArray(message[1]) ? message[1][0] : message[1];
|
|
103
95
|
// ".math_equation_latex" is the elem we added for MathJax to typeset the image equation
|
|
104
|
-
if (
|
|
105
|
-
var _elem$parentElement$p;
|
|
96
|
+
if (elem.parentElement?.classList.contains('math_equation_latex')) {
|
|
106
97
|
// The equation we image we were trying to replace and failed is up 1 and back 1.
|
|
107
98
|
// If we remove its "mathjaxified" attribute, the "End Math" handler
|
|
108
99
|
// won't remove it from the DOM.
|
|
109
|
-
if (
|
|
100
|
+
if (elem.parentElement.previousElementSibling?.hasAttribute('mathjaxified')) {
|
|
110
101
|
elem.parentElement.previousElementSibling.removeAttribute('mathjaxified');
|
|
111
102
|
}
|
|
112
103
|
// remove the "math processing error" mathjax output.
|
|
@@ -152,7 +143,7 @@ class Mathml {
|
|
|
152
143
|
// something has changed on the page and needs to get pulled into the MathJax ecosystem
|
|
153
144
|
// window.MathJax.Hub.Reprocess([document.body])
|
|
154
145
|
window.MathJax.Hub.Queue(['Typeset', window.MathJax.Hub]);
|
|
155
|
-
cb
|
|
146
|
+
cb?.();
|
|
156
147
|
}
|
|
157
148
|
}
|
|
158
149
|
preventMathJax() {
|
|
@@ -162,11 +153,10 @@ class Mathml {
|
|
|
162
153
|
return this.isMathInElement(document.body);
|
|
163
154
|
}
|
|
164
155
|
isMathInElement(elem) {
|
|
165
|
-
|
|
166
|
-
if ((elem === null || elem === void 0 ? void 0 : elem.getAttribute('data-testid')) === 'mathml-preview-element') {
|
|
156
|
+
if (elem?.getAttribute('data-testid') === 'mathml-preview-element') {
|
|
167
157
|
return true;
|
|
168
158
|
}
|
|
169
|
-
if (
|
|
159
|
+
if (this._features?.new_math_equation_handling) {
|
|
170
160
|
// handle the change from image + hidden mathml to mathjax formatted latex
|
|
171
161
|
if (elem.querySelector('.math_equation_latex,.math_equation_mml')) {
|
|
172
162
|
return true;
|
|
@@ -200,9 +190,8 @@ class Mathml {
|
|
|
200
190
|
return '#header,#mobile-header,#left-side,#quiz-elapsed-time,.ui-menu-carat';
|
|
201
191
|
}
|
|
202
192
|
isMathJaxIgnored(elem) {
|
|
203
|
-
var _this$_features4, _elem$parentElement2;
|
|
204
193
|
if (!elem) return true;
|
|
205
|
-
if (
|
|
194
|
+
if (this._features?.explicit_latex_typesetting && !elem.classList.contains(MathJaxDirective.Process)) {
|
|
206
195
|
return true;
|
|
207
196
|
}
|
|
208
197
|
|
|
@@ -210,7 +199,7 @@ class Mathml {
|
|
|
210
199
|
if (!document.body.contains(elem)) return true;
|
|
211
200
|
|
|
212
201
|
// check if elem is in the ignore list
|
|
213
|
-
if (
|
|
202
|
+
if (elem.parentElement?.querySelector(this.ignore_list) === elem) {
|
|
214
203
|
return true;
|
|
215
204
|
}
|
|
216
205
|
|
|
@@ -238,8 +227,7 @@ class Mathml {
|
|
|
238
227
|
return this.isMathOnPage();
|
|
239
228
|
}
|
|
240
229
|
isMathJaxLoaded() {
|
|
241
|
-
|
|
242
|
-
return !!((_window$MathJax = window.MathJax) !== null && _window$MathJax !== void 0 && _window$MathJax.Hub);
|
|
230
|
+
return !!window.MathJax?.Hub;
|
|
243
231
|
}
|
|
244
232
|
shouldProcess(elem) {
|
|
245
233
|
return this.isMathInElement(elem) && !this.isMathJaxIgnored(elem);
|
|
@@ -338,7 +326,7 @@ const mathImageHelper = {
|
|
|
338
326
|
}
|
|
339
327
|
};
|
|
340
328
|
function handleNewMath(event) {
|
|
341
|
-
if (event
|
|
329
|
+
if (event?.detail) {
|
|
342
330
|
const {
|
|
343
331
|
features,
|
|
344
332
|
config,
|
|
@@ -29,10 +29,8 @@ const MEDIA_COMMENT_THUMBNAIL_SIZES = {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
function createMediaCommentThumbnail(elem, size, keepOriginalText, kalturaSettings) {
|
|
32
|
-
var _window$INST, _$link$querySelector, _$link$parentElement$, _$link$parentElement$2;
|
|
33
32
|
// a lot of places in canvas rely on INST.kalturaSettings. Fallback if they are not provided
|
|
34
|
-
const kalturaSettings_ = kalturaSettings ||
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
33
|
+
const kalturaSettings_ = kalturaSettings || window.INST?.kalturaSettings;
|
|
36
34
|
if (!kalturaSettings_) return console.log('Kaltura has not been enabled for this account');
|
|
37
35
|
let idAttr, url;
|
|
38
36
|
const $link = elem;
|
|
@@ -41,7 +39,6 @@ function createMediaCommentThumbnail(elem, size, keepOriginalText, kalturaSettin
|
|
|
41
39
|
a.href = $link.getAttribute('href');
|
|
42
40
|
url = a;
|
|
43
41
|
} catch (error) {
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
42
|
console.error(error);
|
|
46
43
|
}
|
|
47
44
|
if (url) {
|
|
@@ -49,7 +46,7 @@ function createMediaCommentThumbnail(elem, size, keepOriginalText, kalturaSettin
|
|
|
49
46
|
if (urlParams.has('no_preview') && urlParams.get('no_preview') !== 'false') return;
|
|
50
47
|
}
|
|
51
48
|
const dimensions = MEDIA_COMMENT_THUMBNAIL_SIZES[size] || MEDIA_COMMENT_THUMBNAIL_SIZES.normal;
|
|
52
|
-
const id = getData($link, 'media_comment_id') || $link.getAttribute('data-media_comment_id') ||
|
|
49
|
+
const id = getData($link, 'media_comment_id') || $link.getAttribute('data-media_comment_id') || $link.querySelector('.media_comment_id')?.textContent || (idAttr = $link.id) && idAttr.match(/^media_comment_/) && idAttr.substring(14) || $link.parentElement.querySelector('.media_comment_id')?.textContent?.trim();
|
|
53
50
|
const authorName = getData($link, 'author') || $link.getAttribute('data-author');
|
|
54
51
|
const createdAt = getData($link, 'created_at') || $link.getAttribute('data-created_at');
|
|
55
52
|
let altText;
|
|
@@ -101,11 +98,7 @@ function createMediaCommentThumbnail(elem, size, keepOriginalText, kalturaSettin
|
|
|
101
98
|
}
|
|
102
99
|
|
|
103
100
|
// public API
|
|
104
|
-
export default function mediaCommentThumbnail(comment_element) {
|
|
105
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal';
|
|
106
|
-
let keepOriginalText = arguments.length > 2 ? arguments[2] : undefined;
|
|
107
|
-
let kalturaSettings = arguments.length > 3 ? arguments[3] : undefined;
|
|
108
|
-
let jqueryData = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
|
|
101
|
+
export default function mediaCommentThumbnail(comment_element, size = 'normal', keepOriginalText, kalturaSettings, jqueryData = undefined) {
|
|
109
102
|
// defer each thumbnail generation till the next time through the event loop to not kill browser rendering,
|
|
110
103
|
// has the effect of saying "only work on thumbnailing these while the browser is not doing something else"
|
|
111
104
|
return new Promise(resolve => window.setTimeout(() => {
|
package/es/format-message.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import formatMessage from 'format-message';
|
|
20
20
|
const ns = formatMessage.namespace();
|
|
21
21
|
ns.addLocale = translations => {
|
|
22
22
|
ns.setup({
|
|
@@ -26,4 +26,4 @@ ns.addLocale = translations => {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
export default ns;
|
package/es/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export { getContrastStatus, getDefaultColors, isTransparent } from './rce/plugin
|
|
|
27
27
|
export { ColorPicker } from './rce/plugins/instructure_color/components/ColorPicker';
|
|
28
28
|
export * from './enhance-user-content/index';
|
|
29
29
|
export const defaultConfiguration = defaultTinymceConfig;
|
|
30
|
-
export {
|
|
30
|
+
export { instuiPopupMountNodeFn } from './util/fullscreenHelpers';
|
|
31
31
|
export { Mathml };
|
|
32
32
|
export { RCEVariantValues } from './rce/RCEVariants';
|
|
33
33
|
export { UploadFilePanelIds, handleSubmit, UploadFile } from './rce/plugins/shared/Upload';
|
|
@@ -40,11 +40,9 @@ export function renderIntoDiv(editorEl, props, cb) {
|
|
|
40
40
|
// unlike the pretranslated builds, in the default, non-pretranslated build,
|
|
41
41
|
// this will cause a new network round trip to get all the locale info the rce
|
|
42
42
|
// and tinymce need.
|
|
43
|
-
getTranslations(language).
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
43
|
+
getTranslations(language).catch(err => {
|
|
45
44
|
console.error('Failed loading the language file for', language, 'RCE is falling back to English.\n Cause:', err);
|
|
46
|
-
|
|
47
|
-
});
|
|
45
|
+
}).finally(() => render(editorEl, props, cb));
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
export function getRCSAuthenticationHeaders(jwt) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
1
2
|
/*
|
|
2
3
|
* Copyright (C) 2019 - present Instructure, Inc.
|
|
3
4
|
*
|
|
@@ -17,31 +18,29 @@
|
|
|
17
18
|
*/
|
|
18
19
|
import { Alert } from '@instructure/ui-alerts';
|
|
19
20
|
import React from 'react';
|
|
20
|
-
import { arrayOf, func, number, shape, string } from 'prop-types';
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
22
|
* Shows messages that have been provided to it in the RCE
|
|
24
23
|
*/
|
|
25
|
-
export default function AlertMessageArea(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
24
|
+
export default function AlertMessageArea({
|
|
25
|
+
messages,
|
|
26
|
+
afterDismiss,
|
|
27
|
+
liveRegion
|
|
28
|
+
}) {
|
|
31
29
|
return /*#__PURE__*/React.createElement("div", null, messages.map(message => /*#__PURE__*/React.createElement(Alert, {
|
|
32
30
|
key: message.id,
|
|
33
|
-
variant: message.variant ||
|
|
34
|
-
timeout: 10000
|
|
31
|
+
variant: message.variant || 'info',
|
|
32
|
+
timeout: 10000
|
|
33
|
+
// @ts-expect-error
|
|
34
|
+
,
|
|
35
35
|
liveRegion: liveRegion,
|
|
36
36
|
onDismiss: () => afterDismiss(message.id)
|
|
37
37
|
}, message.text)));
|
|
38
38
|
}
|
|
39
39
|
AlertMessageArea.propTypes = {
|
|
40
|
-
messages: arrayOf(shape({
|
|
41
|
-
id: number,
|
|
42
|
-
|
|
43
|
-
text: string
|
|
40
|
+
messages: _pt.arrayOf(_pt.shape({
|
|
41
|
+
id: _pt.number.isRequired,
|
|
42
|
+
text: _pt.string.isRequired
|
|
44
43
|
})).isRequired,
|
|
45
|
-
afterDismiss: func,
|
|
46
|
-
liveRegion: func
|
|
44
|
+
afterDismiss: _pt.func.isRequired,
|
|
45
|
+
liveRegion: _pt.func
|
|
47
46
|
};
|
|
@@ -26,7 +26,7 @@ import { CloseButton } from '@instructure/ui-buttons';
|
|
|
26
26
|
import { View } from '@instructure/ui-view';
|
|
27
27
|
import formatMessage from '../format-message';
|
|
28
28
|
import { determineOSDependentKey } from './userOS';
|
|
29
|
-
import {
|
|
29
|
+
import { instuiPopupMountNodeFn } from '../util/fullscreenHelpers';
|
|
30
30
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
31
31
|
export default function KeyboardShortcutModal(props) {
|
|
32
32
|
const OSKey = determineOSDependentKey();
|
|
@@ -34,7 +34,7 @@ export default function KeyboardShortcutModal(props) {
|
|
|
34
34
|
"data-testid": "RCE_KeyboardShortcutModal",
|
|
35
35
|
"data-mce-component": true,
|
|
36
36
|
label: formatMessage('Keyboard Shortcuts'),
|
|
37
|
-
mountNode:
|
|
37
|
+
mountNode: instuiPopupMountNodeFn,
|
|
38
38
|
open: props.open,
|
|
39
39
|
shouldCloseOnDocumentClick: true,
|
|
40
40
|
shouldReturnFocus: true,
|
package/es/rce/RCE.js
CHANGED
|
@@ -19,16 +19,17 @@
|
|
|
19
19
|
import React, { forwardRef, useState } from 'react';
|
|
20
20
|
import formatMessage from '../format-message';
|
|
21
21
|
import RCEWrapper from './RCEWrapper';
|
|
22
|
-
import editorLanguage from './editorLanguage';
|
|
22
|
+
import { editorLanguage } from './editorLanguage';
|
|
23
23
|
import normalizeLocale from './normalizeLocale';
|
|
24
24
|
import wrapInitCb from './wrapInitCb';
|
|
25
25
|
import tinyRCE from './tinyRCE';
|
|
26
26
|
import getTranslations from '../getTranslations';
|
|
27
27
|
import '@instructure/canvas-theme';
|
|
28
|
+
import generateId from 'format-message-generate-id/underscored_crc32';
|
|
28
29
|
if (!process || !process.env || !undefined) {
|
|
29
30
|
formatMessage.setup({
|
|
30
31
|
locale: 'en',
|
|
31
|
-
generateId
|
|
32
|
+
generateId,
|
|
32
33
|
missingTranslation: 'ignore'
|
|
33
34
|
});
|
|
34
35
|
}
|
|
@@ -73,7 +74,6 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
73
74
|
const p = getTranslations(locale).then(() => {
|
|
74
75
|
setTranslations(true);
|
|
75
76
|
}).catch(err => {
|
|
76
|
-
// eslint-disable-next-line no-console
|
|
77
77
|
console.error('Failed loading the language file for', locale, '\n Cause:', err);
|
|
78
78
|
setTranslations(false);
|
|
79
79
|
});
|
|
@@ -102,7 +102,7 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
102
102
|
features,
|
|
103
103
|
editorOptions: {
|
|
104
104
|
...editorOptions,
|
|
105
|
-
selector:
|
|
105
|
+
selector: editorOptions?.selector || `#${textareaId}`,
|
|
106
106
|
height,
|
|
107
107
|
language: editorLanguage(props.language)
|
|
108
108
|
},
|
|
@@ -115,6 +115,7 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
115
115
|
return /*#__PURE__*/React.createElement(React.Fragment, null, formatMessage('Loading...'));
|
|
116
116
|
} else {
|
|
117
117
|
return /*#__PURE__*/React.createElement(RCEWrapper, Object.assign({
|
|
118
|
+
name: "content",
|
|
118
119
|
ref: rceRef,
|
|
119
120
|
tinymce: tinyRCE,
|
|
120
121
|
readOnly: readOnly
|
|
@@ -126,7 +127,7 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
126
127
|
}, rest));
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
|
-
|
|
130
|
+
RCE.defaultProps = {
|
|
130
131
|
autosave: {
|
|
131
132
|
enabled: false,
|
|
132
133
|
maxAge: 3600000
|
|
@@ -147,7 +148,4 @@ const defaultProps = {
|
|
|
147
148
|
onContentChange: () => undefined,
|
|
148
149
|
onInit: () => undefined
|
|
149
150
|
};
|
|
150
|
-
|
|
151
|
-
// @ts-expect-error
|
|
152
|
-
RCE.defaultProps = defaultProps;
|
|
153
151
|
export default RCE;
|
package/es/rce/RCEVariants.js
CHANGED
|
@@ -55,8 +55,7 @@ export function getMenuForVariant(variant) {
|
|
|
55
55
|
}
|
|
56
56
|
return {};
|
|
57
57
|
}
|
|
58
|
-
export function getToolbarForVariant(variant) {
|
|
59
|
-
let ltiToolFavorites = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
58
|
+
export function getToolbarForVariant(variant, ltiToolFavorites = []) {
|
|
60
59
|
if (variant === 'lite') {
|
|
61
60
|
return [{
|
|
62
61
|
name: formatMessage('Styles'),
|
|
@@ -122,8 +121,7 @@ export function getToolbarForVariant(variant) {
|
|
|
122
121
|
items: ['removeformat', 'table', 'instructure_equation', 'instructure_media_embed']
|
|
123
122
|
}];
|
|
124
123
|
}
|
|
125
|
-
export function getStatusBarFeaturesForVariant(variant) {
|
|
126
|
-
let ai_text_tools = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
124
|
+
export function getStatusBarFeaturesForVariant(variant, ai_text_tools = false) {
|
|
127
125
|
if (variant === 'lite' || variant === 'text-only') {
|
|
128
126
|
return ['keyboard_shortcuts', 'a11y_checker', 'word_count'];
|
|
129
127
|
}
|