@instructure/canvas-rce 7.0.0 → 7.3.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 +60 -1
- package/__tests__/common/indicate.test.js +5 -6
- package/es/bridge/Bridge.js +2 -4
- package/es/canvasFileBrowser/FileBrowser.js +2 -4
- package/es/defaultTinymceConfig.d.ts +1 -1
- package/es/defaultTinymceConfig.js +149 -114
- package/es/enhance-user-content/doc_previews.js +1 -14
- package/es/enhance-user-content/enhance_user_content.js +7 -1
- package/es/enhance-user-content/instructure_helper.js +4 -0
- package/es/enhance-user-content/youtube_overlay.d.ts +1 -0
- package/es/enhance-user-content/youtube_overlay.js +87 -0
- package/es/format-message.d.js +1 -0
- package/es/format-message.js +5 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/rce/AlertMessageArea.d.ts +2 -2
- package/es/rce/AlertMessageArea.js +4 -6
- package/es/rce/RCE.d.ts +0 -1
- package/es/rce/RCE.js +5 -10
- package/es/rce/RCEGlobals.d.ts +2 -0
- package/es/rce/RCEGlobals.js +1 -0
- package/es/rce/RCEVariants.d.ts +8 -3
- package/es/rce/RCEVariants.js +31 -5
- package/es/rce/RCEWrapper.d.ts +16 -14
- package/es/rce/RCEWrapper.js +260 -244
- package/es/rce/RCEWrapperProps.d.ts +1 -1
- package/es/rce/ShowOnFocusButton/index.js +4 -2
- package/es/rce/StatusBar.js +61 -15
- package/es/rce/alertHandler.js +6 -7
- package/es/rce/plugins/instructure-ui-icons/plugin.js +2 -2
- package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +6 -10
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.d.ts +5 -15
- package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +4 -10
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.d.ts +7 -0
- package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +45 -2
- package/es/rce/plugins/instructure_keyboard_shortcuts_header/clickCallback.d.ts +2 -0
- package/es/rce/plugins/instructure_keyboard_shortcuts_header/clickCallback.js +45 -0
- package/es/rce/plugins/instructure_keyboard_shortcuts_header/plugin.d.ts +1 -0
- package/es/rce/plugins/instructure_keyboard_shortcuts_header/plugin.js +43 -0
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.d.ts +1 -8
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +13 -33
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.d.ts +1 -2
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +2 -1
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.d.ts +1 -1
- package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +25 -25
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.d.ts +1 -1
- package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +2 -1
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.d.ts +1 -1
- package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +2 -1
- package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +10 -7
- package/es/rce/plugins/instructure_record/mediaTranslations.js +1 -1
- package/es/rce/plugins/instructure_studio_media_options/plugin.js +109 -14
- package/es/rce/plugins/instructure_studio_media_options/studioToolbarIcons.d.ts +5 -0
- package/es/rce/plugins/instructure_studio_media_options/studioToolbarIcons.js +23 -0
- package/es/rce/plugins/instructure_wordcount_header/plugin.d.ts +1 -0
- package/es/rce/plugins/instructure_wordcount_header/plugin.js +75 -0
- package/es/rce/plugins/shared/ContentSelection.d.ts +1 -2
- package/es/rce/plugins/shared/ContentSelection.js +1 -18
- package/es/rce/plugins/shared/DimensionsInput/index.js +3 -3
- package/es/rce/plugins/shared/FixedContentTray.d.ts +7 -23
- package/es/rce/plugins/shared/FixedContentTray.js +7 -16
- package/es/rce/plugins/shared/ImageCropper/constants.d.ts +1 -1
- package/es/rce/plugins/shared/ImageCropper/constants.js +1 -1
- package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +1 -1
- package/es/rce/plugins/shared/PreviewIcon.js +1 -1
- package/es/rce/plugins/shared/StudioLtiSupportUtils.d.ts +9 -1
- package/es/rce/plugins/shared/StudioLtiSupportUtils.js +94 -1
- package/es/rce/plugins/shared/Upload/ComputerPanel.js +1 -1
- package/es/rce/plugins/shared/Upload/UploadFileModal.js +37 -4
- package/es/rce/plugins/shared/Upload/VideoUrlPanel.d.ts +15 -0
- package/es/rce/plugins/shared/Upload/VideoUrlPanel.js +51 -0
- package/es/rce/plugins/shared/Upload/videoValidationUtils.d.ts +7 -0
- package/es/rce/plugins/shared/Upload/videoValidationUtils.js +58 -0
- package/es/rce/plugins/shared/ai_tools/aiicons.d.ts +3 -3
- package/es/rce/plugins/shared/ai_tools/aiicons.js +11 -11
- package/es/rce/plugins/shared/iframeUtils.d.ts +1 -0
- package/es/rce/plugins/shared/iframeUtils.js +37 -0
- package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +7 -1
- package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.d.ts +1 -1
- package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +1 -1
- package/es/rce/style.js +19 -17
- package/es/rce/tinyRCE.js +2 -0
- package/es/sidebar/actions/upload.d.ts +1 -0
- package/es/sidebar/actions/upload.js +56 -0
- package/es/sidebar/containers/sidebarHandlers.d.ts +1 -0
- package/es/sidebar/containers/sidebarHandlers.js +2 -1
- package/es/translations/locales/ar.js +44 -11
- package/es/translations/locales/ca.js +47 -14
- package/es/translations/locales/cy.js +44 -11
- package/es/translations/locales/da-x-k12.js +44 -11
- package/es/translations/locales/da.js +44 -11
- package/es/translations/locales/de.js +44 -11
- package/es/translations/locales/el.js +6 -0
- package/es/translations/locales/en-AU-x-unimelb.js +44 -11
- package/es/translations/locales/en-GB-x-ukhe.js +44 -11
- package/es/translations/locales/en.js +47 -11
- package/es/translations/locales/en_AU.js +44 -11
- package/es/translations/locales/en_CA.js +44 -11
- package/es/translations/locales/en_CY.js +44 -11
- package/es/translations/locales/en_GB.js +44 -11
- package/es/translations/locales/es.js +44 -11
- package/es/translations/locales/es_ES.js +44 -11
- package/es/translations/locales/fa_IR.js +6 -6
- package/es/translations/locales/fi.js +44 -11
- package/es/translations/locales/fr.js +44 -11
- package/es/translations/locales/fr_CA.js +49 -16
- package/es/translations/locales/ga.js +61 -28
- package/es/translations/locales/he.js +6 -0
- package/es/translations/locales/hi.js +44 -11
- package/es/translations/locales/ht.js +44 -11
- package/es/translations/locales/hu.js +6 -12
- package/es/translations/locales/hy.js +6 -0
- package/es/translations/locales/id.js +44 -11
- package/es/translations/locales/is.js +44 -11
- package/es/translations/locales/it.js +44 -11
- package/es/translations/locales/ja.js +44 -11
- package/es/translations/locales/ko.js +6 -0
- package/es/translations/locales/mi.js +44 -11
- package/es/translations/locales/ms.js +44 -11
- package/es/translations/locales/nb-x-k12.js +44 -11
- package/es/translations/locales/nb.js +44 -11
- package/es/translations/locales/nl.js +44 -11
- package/es/translations/locales/nn.js +6 -12
- package/es/translations/locales/pl.js +44 -11
- package/es/translations/locales/pt.js +44 -11
- package/es/translations/locales/pt_BR.js +44 -11
- package/es/translations/locales/ru.js +44 -11
- package/es/translations/locales/sl.js +44 -11
- package/es/translations/locales/sv-x-k12.js +44 -11
- package/es/translations/locales/sv.js +44 -11
- package/es/translations/locales/th.js +44 -11
- package/es/translations/locales/tr.js +6 -3
- package/es/translations/locales/uk_UA.js +6 -9
- package/es/translations/locales/vi.js +44 -11
- package/es/translations/locales/zh-Hans.js +44 -11
- package/es/translations/locales/zh-Hant.js +44 -11
- package/es/translations/locales/zh.js +44 -11
- package/es/translations/locales/zh_HK.js +44 -11
- package/es/util/contextHelper.d.ts +7 -0
- package/{testcafe/axe.test.js → es/util/contextHelper.js} +10 -21
- package/es/util/loadingPlaceholder.js +11 -11
- package/eslint.config.js +3 -25
- package/jest/jest-setup.js +27 -2
- package/jest.config.js +5 -1
- package/package.json +61 -84
- package/testcafe/RCEWrapper.test.js +0 -319
- package/testcafe/StatusBar.test.js +0 -108
- package/testcafe/enhanceUserContent.html +0 -58
- package/testcafe/enhanceUserContent.test.js +0 -44
- package/testcafe/entry.jsx +0 -77
- package/testcafe/testcafe.html +0 -14
- package/webpack.testcafe.config.js +0 -61
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import { Text } from '@instructure/ui-text';
|
|
5
|
+
import { View } from '@instructure/ui-view';
|
|
6
|
+
import { Flex } from '@instructure/ui-flex';
|
|
7
|
+
import { CondensedButton } from '@instructure/ui-buttons';
|
|
8
|
+
import { IconPlayLine } from '@instructure/ui-icons';
|
|
9
|
+
import formatMessage from '../format-message';
|
|
10
|
+
const YoutubeEmbedOverlay = ({
|
|
11
|
+
iframeElement,
|
|
12
|
+
height,
|
|
13
|
+
width
|
|
14
|
+
}) => {
|
|
15
|
+
const [showOverlay, setShowOverlay] = useState(true);
|
|
16
|
+
const containerRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (containerRef.current && iframeElement) {
|
|
19
|
+
if (width) {
|
|
20
|
+
containerRef.current.style.width = `${width}px`;
|
|
21
|
+
}
|
|
22
|
+
if (height) {
|
|
23
|
+
containerRef.current.style.height = `${height}px`;
|
|
24
|
+
}
|
|
25
|
+
containerRef.current.appendChild(iframeElement);
|
|
26
|
+
}
|
|
27
|
+
}, [height, iframeElement, width]);
|
|
28
|
+
const handleCloseOverlay = useCallback(() => {
|
|
29
|
+
setShowOverlay(false);
|
|
30
|
+
}, [setShowOverlay]);
|
|
31
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
32
|
+
as: "div",
|
|
33
|
+
position: "relative",
|
|
34
|
+
display: "inline-block"
|
|
35
|
+
}, showOverlay && /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
as: "div",
|
|
37
|
+
position: "absolute",
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "100%",
|
|
40
|
+
background: "primary",
|
|
41
|
+
themeOverride: {
|
|
42
|
+
backgroundPrimary: 'rgba(10, 71, 91, 0.65)'
|
|
43
|
+
},
|
|
44
|
+
overflowY: "hidden"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
46
|
+
justifyItems: "center",
|
|
47
|
+
height: "100%"
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Flex.Item, {
|
|
49
|
+
shouldShrink: true,
|
|
50
|
+
shouldGrow: true,
|
|
51
|
+
textAlign: "center"
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
53
|
+
justifyItems: "center",
|
|
54
|
+
margin: "0 0 small"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(Text, {
|
|
56
|
+
color: "secondary-inverse",
|
|
57
|
+
weight: "bold"
|
|
58
|
+
}, formatMessage('This video may display YouTube ads.')))), /*#__PURE__*/React.createElement(Flex, {
|
|
59
|
+
justifyItems: "center",
|
|
60
|
+
margin: "0 0 medium"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(CondensedButton, {
|
|
62
|
+
"data-test-id": "youtube-migration-close-overlay",
|
|
63
|
+
color: "primary-inverse",
|
|
64
|
+
onClick: handleCloseOverlay
|
|
65
|
+
}, /*#__PURE__*/React.createElement(IconPlayLine, null), "\xA0", formatMessage('Continue to YouTube content'))))))), /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
ref: containerRef
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
YoutubeEmbedOverlay.propTypes = {
|
|
70
|
+
height: _pt.number.isRequired,
|
|
71
|
+
width: _pt.number.isRequired
|
|
72
|
+
};
|
|
73
|
+
export const createOverlay = iframes => {
|
|
74
|
+
iframes.forEach(iframe => {
|
|
75
|
+
const iframeElement = iframe;
|
|
76
|
+
const height = iframeElement.offsetHeight;
|
|
77
|
+
const width = iframeElement.offsetWidth;
|
|
78
|
+
const container = document.createElement('div');
|
|
79
|
+
container.setAttribute('data-test-id', 'youtube-migration-container');
|
|
80
|
+
iframe.replaceWith(container);
|
|
81
|
+
createRoot(container).render(/*#__PURE__*/React.createElement(YoutubeEmbedOverlay, {
|
|
82
|
+
iframeElement: iframeElement,
|
|
83
|
+
height: height,
|
|
84
|
+
width: width
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/format-message.js
CHANGED
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import formatMessage from 'format-message';
|
|
20
|
+
import generateId from 'format-message-generate-id/underscored_crc32';
|
|
20
21
|
const ns = formatMessage.namespace();
|
|
22
|
+
ns.setup({
|
|
23
|
+
generateId,
|
|
24
|
+
missingTranslation: 'ignore'
|
|
25
|
+
});
|
|
21
26
|
ns.addLocale = translations => {
|
|
22
27
|
ns.setup({
|
|
23
28
|
translations: {
|
package/es/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const defaultConfiguration: {
|
|
|
16
16
|
menubar: undefined;
|
|
17
17
|
menu: undefined;
|
|
18
18
|
toolbar: undefined;
|
|
19
|
+
color_map: string[];
|
|
19
20
|
plugins: undefined;
|
|
20
21
|
branding: boolean;
|
|
21
22
|
browser_spellcheck: boolean;
|
|
@@ -25,7 +26,6 @@ export declare const defaultConfiguration: {
|
|
|
25
26
|
language_load: boolean;
|
|
26
27
|
language_url: string;
|
|
27
28
|
toolbar_mode: string;
|
|
28
|
-
toolbar_ticky: boolean;
|
|
29
29
|
mobile: {
|
|
30
30
|
theme: string;
|
|
31
31
|
};
|
|
@@ -57,3 +57,4 @@ export declare function getRCSAuthenticationHeaders(jwt: string): {
|
|
|
57
57
|
Authorization: string;
|
|
58
58
|
};
|
|
59
59
|
export declare function getRCSOriginFromHost(host: string): any;
|
|
60
|
+
export { default as checkNode } from './rce/plugins/tinymce-a11y-checker/node-checker';
|
package/es/index.js
CHANGED
|
@@ -16,8 +16,8 @@ import _pt from "prop-types";
|
|
|
16
16
|
* You should have received a copy of the GNU Affero General Public License along
|
|
17
17
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
*/
|
|
19
|
-
import { Alert } from
|
|
20
|
-
import React from
|
|
19
|
+
import { Alert } from "@instructure/ui-alerts";
|
|
20
|
+
import React from "react";
|
|
21
21
|
/**
|
|
22
22
|
* Shows messages that have been provided to it in the RCE
|
|
23
23
|
*/
|
|
@@ -28,10 +28,8 @@ export default function AlertMessageArea({
|
|
|
28
28
|
}) {
|
|
29
29
|
return /*#__PURE__*/React.createElement("div", null, messages.map(message => /*#__PURE__*/React.createElement(Alert, {
|
|
30
30
|
key: message.id,
|
|
31
|
-
variant: message.variant ||
|
|
32
|
-
timeout: 10000
|
|
33
|
-
// @ts-expect-error
|
|
34
|
-
,
|
|
31
|
+
variant: message.variant || "info",
|
|
32
|
+
timeout: 10000,
|
|
35
33
|
liveRegion: liveRegion,
|
|
36
34
|
onDismiss: () => afterDismiss(message.id)
|
|
37
35
|
}, message.text)));
|
package/es/rce/RCE.d.ts
CHANGED
package/es/rce/RCE.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import React, { forwardRef, useState } from 'react';
|
|
19
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
20
20
|
import formatMessage from '../format-message';
|
|
21
21
|
import RCEWrapper from './RCEWrapper';
|
|
22
22
|
import { editorLanguage } from './editorLanguage';
|
|
@@ -69,15 +69,10 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
69
69
|
locale: normalizeLocale(props.language)
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
const [
|
|
72
|
+
const [isTranslationLoading, setIsTranslationLoading] = useState(true);
|
|
73
|
+
useEffect(() => {
|
|
73
74
|
const locale = normalizeLocale(props.language);
|
|
74
|
-
|
|
75
|
-
setTranslations(true);
|
|
76
|
-
}).catch(err => {
|
|
77
|
-
console.error('Failed loading the language file for', locale, '\n Cause:', err);
|
|
78
|
-
setTranslations(false);
|
|
79
|
-
});
|
|
80
|
-
return p;
|
|
75
|
+
getTranslations(locale).catch(err => console.error('Failed loading the language file for', locale, '\n Cause:', err)).finally(() => setIsTranslationLoading(false));
|
|
81
76
|
});
|
|
82
77
|
|
|
83
78
|
// some properties are only used on initialization
|
|
@@ -111,7 +106,7 @@ const RCE = /*#__PURE__*/forwardRef(function RCE(props, rceRef) {
|
|
|
111
106
|
wrapInitCb(mirroredAttrs || {}, iProps.editorOptions);
|
|
112
107
|
return iProps;
|
|
113
108
|
});
|
|
114
|
-
if (
|
|
109
|
+
if (isTranslationLoading) {
|
|
115
110
|
return /*#__PURE__*/React.createElement(React.Fragment, null, formatMessage('Loading...'));
|
|
116
111
|
} else {
|
|
117
112
|
return /*#__PURE__*/React.createElement(RCEWrapper, Object.assign({
|
package/es/rce/RCEGlobals.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export default instance;
|
|
2
2
|
export type Features = {
|
|
3
3
|
file_verifiers_for_quiz_links: boolean;
|
|
4
|
+
rce_studio_embed_improvements: boolean;
|
|
4
5
|
};
|
|
5
6
|
declare const instance: RCEGlobals;
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {Object} Features
|
|
8
9
|
* @property {boolean} file_verifiers_for_quiz_links
|
|
10
|
+
* @property {boolean} rce_studio_embed_improvements
|
|
9
11
|
*/
|
|
10
12
|
declare class RCEGlobals {
|
|
11
13
|
_data: {
|
package/es/rce/RCEGlobals.js
CHANGED
package/es/rce/RCEVariants.d.ts
CHANGED
|
@@ -7,11 +7,16 @@ interface ToolbarGroupSetting {
|
|
|
7
7
|
name: string;
|
|
8
8
|
items: string[];
|
|
9
9
|
}
|
|
10
|
-
type StatusBarFeature = 'ai_tools' | 'keyboard_shortcuts' | 'a11y_checker' | 'word_count' | 'html_view' | 'fullscreen' | 'resize_handle';
|
|
11
|
-
export declare const RCEVariantValues: readonly ["full", "lite", "text-only", "text-block"];
|
|
10
|
+
type StatusBarFeature = 'ai_tools' | 'keyboard_shortcuts' | 'a11y_checker' | 'word_count' | 'html_view' | 'fullscreen' | 'resize_handle' | 'a11y_resize_handlers';
|
|
11
|
+
export declare const RCEVariantValues: readonly ["full", "lite", "text-only", "text-block", "block-content-editor"];
|
|
12
12
|
export type RCEVariant = (typeof RCEVariantValues)[number];
|
|
13
|
+
export type StatusBarOptions = {
|
|
14
|
+
aiTextTools?: boolean;
|
|
15
|
+
isDesktop?: boolean;
|
|
16
|
+
a11yResizers?: boolean;
|
|
17
|
+
};
|
|
13
18
|
export declare function getMenubarForVariant(variant: RCEVariant): MenuBarSpec;
|
|
14
19
|
export declare function getMenuForVariant(variant: RCEVariant): MenusSpec;
|
|
15
20
|
export declare function getToolbarForVariant(variant: RCEVariant, ltiToolFavorites?: string[]): ToolbarGroupSetting[];
|
|
16
|
-
export declare function getStatusBarFeaturesForVariant(variant: RCEVariant,
|
|
21
|
+
export declare function getStatusBarFeaturesForVariant(variant: RCEVariant, options?: StatusBarOptions): StatusBarFeature[];
|
|
17
22
|
export {};
|
package/es/rce/RCEVariants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2025 - present Instructure, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of Canvas.
|
|
5
5
|
*
|
|
@@ -21,7 +21,7 @@ import formatMessage from '../format-message';
|
|
|
21
21
|
|
|
22
22
|
// copied from node_modules/tinymce/tinymce.d.ts:1187
|
|
23
23
|
|
|
24
|
-
export const RCEVariantValues = ['full', 'lite', 'text-only', 'text-block'];
|
|
24
|
+
export const RCEVariantValues = ['full', 'lite', 'text-only', 'text-block', 'block-content-editor'];
|
|
25
25
|
export function getMenubarForVariant(variant) {
|
|
26
26
|
if (variant === 'full') {
|
|
27
27
|
return 'edit view insert format tools table';
|
|
@@ -101,6 +101,24 @@ export function getToolbarForVariant(variant, ltiToolFavorites = []) {
|
|
|
101
101
|
items: ['removeformat', 'instructure_equation']
|
|
102
102
|
}];
|
|
103
103
|
}
|
|
104
|
+
if (variant === 'block-content-editor') {
|
|
105
|
+
return [{
|
|
106
|
+
name: formatMessage('Styles'),
|
|
107
|
+
items: ['fontsizeselect', 'formatselect']
|
|
108
|
+
}, {
|
|
109
|
+
name: formatMessage('Formatting'),
|
|
110
|
+
items: ['bold', 'italic', 'underline', 'instructure_color', 'inst_subscript', 'inst_superscript']
|
|
111
|
+
}, {
|
|
112
|
+
name: formatMessage('Content'),
|
|
113
|
+
items: ['instructure_links']
|
|
114
|
+
}, {
|
|
115
|
+
name: formatMessage('Alignment and Lists'),
|
|
116
|
+
items: ['align', 'bullist', 'inst_indent', 'inst_outdent']
|
|
117
|
+
}, {
|
|
118
|
+
name: formatMessage('Miscellaneous'),
|
|
119
|
+
items: ['removeformat', 'instructure_equation', 'instructure_keyboard_shortcuts_header', 'instructure_wordcount_header']
|
|
120
|
+
}];
|
|
121
|
+
}
|
|
104
122
|
return [{
|
|
105
123
|
name: formatMessage('Styles'),
|
|
106
124
|
items: ['fontsizeselect', 'formatselect']
|
|
@@ -124,13 +142,21 @@ export function getToolbarForVariant(variant, ltiToolFavorites = []) {
|
|
|
124
142
|
const DESKTOP_FEATURES = ['keyboard_shortcuts', 'a11y_checker', 'word_count'];
|
|
125
143
|
const MOBILE_FEATURES = ['a11y_checker', 'word_count'];
|
|
126
144
|
const EXTENDED_FEATURES = ['html_view', 'fullscreen', 'resize_handle'];
|
|
127
|
-
|
|
145
|
+
const A11Y_RESIZERS = ['a11y_resize_handlers'];
|
|
146
|
+
export function getStatusBarFeaturesForVariant(variant, options = {
|
|
147
|
+
aiTextTools: false,
|
|
148
|
+
isDesktop: true,
|
|
149
|
+
a11yResizers: false
|
|
150
|
+
}) {
|
|
128
151
|
if (variant === 'text-block') {
|
|
129
152
|
return [];
|
|
130
153
|
}
|
|
131
|
-
|
|
154
|
+
if (variant === 'block-content-editor') {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
const platformFeatures = options.isDesktop ? DESKTOP_FEATURES : MOBILE_FEATURES;
|
|
132
158
|
if (variant === 'lite' || variant === 'text-only') {
|
|
133
159
|
return platformFeatures;
|
|
134
160
|
}
|
|
135
|
-
return [...platformFeatures, ...EXTENDED_FEATURES, ...(aiTextTools ? ['ai_tools'] : [])];
|
|
161
|
+
return [...platformFeatures, ...EXTENDED_FEATURES, ...(options.a11yResizers ? A11Y_RESIZERS : []), ...(options.aiTextTools ? ['ai_tools'] : [])];
|
|
136
162
|
}
|
package/es/rce/RCEWrapper.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import React, { ReactNode } from
|
|
2
|
-
import { Editor } from
|
|
3
|
-
import tinymce from
|
|
4
|
-
import type { Editor as TinyMCEEditor } from
|
|
5
|
-
import { PlaceHoldableThingInfo } from
|
|
6
|
-
import EncryptedStorage from
|
|
7
|
-
import { RCEVariant } from
|
|
8
|
-
import { mergeMenu, mergeMenuItems, mergePlugins, mergeToolbar, parsePluginsToExclude } from
|
|
9
|
-
import { AlertMessage, EditorOptions, RCETrayProps } from
|
|
10
|
-
export declare function storageAvailable(): boolean |
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Editor } from "@tinymce/tinymce-react";
|
|
3
|
+
import tinymce from "tinymce";
|
|
4
|
+
import type { Editor as TinyMCEEditor } from "tinymce";
|
|
5
|
+
import { PlaceHoldableThingInfo } from "../util/loadingPlaceholder";
|
|
6
|
+
import EncryptedStorage from "../util/encrypted-storage";
|
|
7
|
+
import { RCEVariant } from "./RCEVariants";
|
|
8
|
+
import { mergeMenu, mergeMenuItems, mergePlugins, mergeToolbar, parsePluginsToExclude } from "./RCEWrapper.utils";
|
|
9
|
+
import { AlertMessage, EditorOptions, RCETrayProps } from "./types";
|
|
10
|
+
export declare function storageAvailable(): boolean | null;
|
|
11
11
|
interface RCEWrapperProps {
|
|
12
12
|
ai_text_tools?: boolean;
|
|
13
13
|
autosave?: {
|
|
14
14
|
enabled?: boolean;
|
|
15
15
|
maxAge?: number;
|
|
16
|
-
interval?: number;
|
|
17
16
|
};
|
|
18
17
|
canvasOrigin: string;
|
|
19
18
|
defaultContent?: string;
|
|
@@ -75,6 +74,7 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
75
74
|
_showOnFocusButton?: HTMLElement;
|
|
76
75
|
_statusBarId: string;
|
|
77
76
|
_textareaEl?: HTMLTextAreaElement;
|
|
77
|
+
_effectiveContainingContext: RCETrayProps["containingContext"];
|
|
78
78
|
AIToolsTray?: ReactNode;
|
|
79
79
|
editor: TinyMCEEditor | null;
|
|
80
80
|
initialContent?: string;
|
|
@@ -191,7 +191,7 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
191
191
|
maxMruTools: import("prop-types").Requireable<number>;
|
|
192
192
|
}>>;
|
|
193
193
|
ai_text_tools: import("prop-types").Requireable<boolean>;
|
|
194
|
-
variant: import("prop-types").Requireable<"full" | "lite" | "text-only" | "text-block">;
|
|
194
|
+
variant: import("prop-types").Requireable<"full" | "lite" | "text-only" | "text-block" | "block-content-editor">;
|
|
195
195
|
};
|
|
196
196
|
static defaultProps: {
|
|
197
197
|
trayProps: null;
|
|
@@ -214,6 +214,7 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
214
214
|
new_math_equation_handling: unknown;
|
|
215
215
|
explicit_latex_typesetting: unknown;
|
|
216
216
|
rce_transform_loaded_content: unknown;
|
|
217
|
+
rce_studio_embed_improvements: unknown;
|
|
217
218
|
file_verifiers_for_quiz_links: unknown;
|
|
218
219
|
rce_find_replace: unknown;
|
|
219
220
|
consolidated_media_player: unknown;
|
|
@@ -315,6 +316,7 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
315
316
|
*/
|
|
316
317
|
_setupSelectionSaving: (editor: any) => void;
|
|
317
318
|
announcing: number;
|
|
319
|
+
_isMounted: boolean;
|
|
318
320
|
announceContextToolbars(editor: TinyMCEEditor): void;
|
|
319
321
|
initAutoSave: (editor: TinyMCEEditor) => void;
|
|
320
322
|
cleanupAutoSave: (deleteAll?: boolean) => void;
|
|
@@ -377,13 +379,13 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
377
379
|
auto_focus: boolean;
|
|
378
380
|
body_class: string;
|
|
379
381
|
directionality: string;
|
|
382
|
+
color_map: string[];
|
|
380
383
|
branding: boolean;
|
|
381
384
|
browser_spellcheck: boolean;
|
|
382
385
|
convert_urls: boolean;
|
|
383
386
|
font_formats: string;
|
|
384
387
|
language_load: boolean;
|
|
385
388
|
language_url: string;
|
|
386
|
-
toolbar_ticky: boolean;
|
|
387
389
|
mobile: {
|
|
388
390
|
theme: string;
|
|
389
391
|
};
|
|
@@ -423,4 +425,4 @@ declare class RCEWrapper extends React.Component<RCEWrapperProps, RCEWrapperStat
|
|
|
423
425
|
render(): React.JSX.Element;
|
|
424
426
|
}
|
|
425
427
|
export default RCEWrapper;
|
|
426
|
-
export { mergeMenuItems, mergeMenu, mergeToolbar, mergePlugins, parsePluginsToExclude };
|
|
428
|
+
export { mergeMenuItems, mergeMenu, mergeToolbar, mergePlugins, parsePluginsToExclude, };
|