fix: add rtl support to editor (#424)

This commit is contained in:
Ihor Romaniuk
2024-08-01 19:21:01 +02:00
committed by GitHub
parent 5825dd36d3
commit ce8703799b
2 changed files with 4 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
useCallback,
useEffect,
} from 'react';
import { getLocale, isRtl } from '@edx/frontend-platform/i18n';
import { a11ycheckerCss } from 'frontend-components-tinymce-advanced-plugins';
import { isEmpty } from 'lodash-es';
import tinyMCEStyles from '../../data/constants/tinyMCEStyles';
@@ -248,6 +249,7 @@ export const editorConfig = ({
quickbarsInsertToolbar,
quickbarsSelectionToolbar,
} = pluginConfig({ isLibrary, placeholder, editorType });
const isLocaleRtl = isRtl(getLocale());
return {
onInit: (evt, editor) => {
@@ -264,6 +266,7 @@ export const editorConfig = ({
content_style: tinyMCEStyles + a11ycheckerCss,
min_height: minHeight,
contextmenu: 'link table',
directionality: isLocaleRtl ? 'rtl' : 'ltr',
document_base_url: lmsEndpointUrl,
imagetools_cors_hosts: [removeProtocolFromUrl(lmsEndpointUrl), removeProtocolFromUrl(studioEndpointUrl)],
imagetools_toolbar: imageToolbar,

View File

@@ -49,6 +49,7 @@ jest.mock('@edx/frontend-platform/i18n', () => {
formatMessage: PropTypes.func,
}),
defineMessages: m => m,
getLocale: () => 'getLocale',
FormattedDate: () => 'FormattedDate',
FormattedMessage: () => 'FormattedMessage',
FormattedTime: () => 'FormattedTime',