Skip to content

Commit ce87037

Browse files
fix: add rtl support to editor (#424)
1 parent 5825dd3 commit ce87037

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/editors/sharedComponents/TinyMceWidget/hooks.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
useCallback,
55
useEffect,
66
} from 'react';
7+
import { getLocale, isRtl } from '@edx/frontend-platform/i18n';
78
import { a11ycheckerCss } from 'frontend-components-tinymce-advanced-plugins';
89
import { isEmpty } from 'lodash-es';
910
import tinyMCEStyles from '../../data/constants/tinyMCEStyles';
@@ -248,6 +249,7 @@ export const editorConfig = ({
248249
quickbarsInsertToolbar,
249250
quickbarsSelectionToolbar,
250251
} = pluginConfig({ isLibrary, placeholder, editorType });
252+
const isLocaleRtl = isRtl(getLocale());
251253

252254
return {
253255
onInit: (evt, editor) => {
@@ -264,6 +266,7 @@ export const editorConfig = ({
264266
content_style: tinyMCEStyles + a11ycheckerCss,
265267
min_height: minHeight,
266268
contextmenu: 'link table',
269+
directionality: isLocaleRtl ? 'rtl' : 'ltr',
267270
document_base_url: lmsEndpointUrl,
268271
imagetools_cors_hosts: [removeProtocolFromUrl(lmsEndpointUrl), removeProtocolFromUrl(studioEndpointUrl)],
269272
imagetools_toolbar: imageToolbar,

src/setupTest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jest.mock('@edx/frontend-platform/i18n', () => {
4949
formatMessage: PropTypes.func,
5050
}),
5151
defineMessages: m => m,
52+
getLocale: () => 'getLocale',
5253
FormattedDate: () => 'FormattedDate',
5354
FormattedMessage: () => 'FormattedMessage',
5455
FormattedTime: () => 'FormattedTime',

0 commit comments

Comments
 (0)