Skip to content

Commit

Permalink
fix: add rtl support to editor (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk authored Aug 1, 2024
1 parent 5825dd3 commit ce87037
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/editors/sharedComponents/TinyMceWidget/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -248,6 +249,7 @@ export const editorConfig = ({
quickbarsInsertToolbar,
quickbarsSelectionToolbar,
} = pluginConfig({ isLibrary, placeholder, editorType });
const isLocaleRtl = isRtl(getLocale());

return {
onInit: (evt, editor) => {
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/setupTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jest.mock('@edx/frontend-platform/i18n', () => {
formatMessage: PropTypes.func,
}),
defineMessages: m => m,
getLocale: () => 'getLocale',
FormattedDate: () => 'FormattedDate',
FormattedMessage: () => 'FormattedMessage',
FormattedTime: () => 'FormattedTime',
Expand Down

0 comments on commit ce87037

Please sign in to comment.