Skip to content

Commit

Permalink
fix: add rtl support to editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk committed Nov 24, 2023
1 parent c0bc54a commit 4524df1
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 tinyMCEStyles from '../../data/constants/tinyMCEStyles';
import { StrictDict } from '../../utils';
import pluginConfig from './pluginConfig';
Expand Down Expand Up @@ -237,6 +238,7 @@ export const editorConfig = ({
quickbarsInsertToolbar,
quickbarsSelectionToolbar,
} = pluginConfig({ isLibrary, placeholder, editorType });
const isLocaleRtl = isRtl(getLocale());

return {
onInit: (evt, editor) => {
Expand All @@ -253,6 +255,7 @@ export const editorConfig = ({
content_style: tinyMCEStyles,
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 @@ -54,6 +54,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 4524df1

Please sign in to comment.