Skip to content

Commit

Permalink
feat: add directionality plugin to the tinyMCE (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
AfaqShuaib09 authored May 19, 2023
1 parent 120fdff commit 9e59252
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 12 additions & 8 deletions src/components/RichEditor/__snapshots__/RichEditor.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ exports[`RichEditor shows a rich text editor and an error 1`] = `
"entity_encoding": "raw",
"extended_valid_elements": "span[lang|id] -span",
"menubar": false,
"plugins": "legacyoutput link lists language",
"plugins": "legacyoutput link lists language directionality",
"selector": "#rich-text-editor-test",
"statusbar": false,
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language",
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language | ltr rtl",
}
}
initialValue={null}
Expand Down Expand Up @@ -74,9 +75,10 @@ exports[`RichEditor shows a rich text editor with default text value 1`] = `
"entity_encoding": "raw",
"extended_valid_elements": "span[lang|id] -span",
"menubar": false,
"plugins": "legacyoutput link lists language",
"plugins": "legacyoutput link lists language directionality",
"selector": "#rich-text-editor-test",
"statusbar": false,
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language",
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language | ltr rtl",
}
}
initialValue="<p>Prior text<p>"
Expand Down Expand Up @@ -119,9 +121,10 @@ exports[`RichEditor shows a rich text editor with no default text value 1`] = `
"entity_encoding": "raw",
"extended_valid_elements": "span[lang|id] -span",
"menubar": false,
"plugins": "legacyoutput link lists language",
"plugins": "legacyoutput link lists language directionality",
"selector": "#rich-text-editor-test",
"statusbar": false,
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language",
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language | ltr rtl",
}
}
initialValue={null}
Expand Down Expand Up @@ -166,9 +169,10 @@ exports[`RichEditor shows a rich text editor with no maxChars 1`] = `
"entity_encoding": "raw",
"extended_valid_elements": "span[lang|id] -span",
"menubar": false,
"plugins": "legacyoutput link lists language",
"plugins": "legacyoutput link lists language directionality",
"selector": "#rich-text-editor-test",
"statusbar": false,
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language",
"toolbar": "undo redo | bold italic underline | bullist numlist | link | language | ltr rtl",
}
}
initialValue="<p>Prior text<p>"
Expand Down
6 changes: 4 additions & 2 deletions src/components/RichEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'tinymce/icons/default';
import 'tinymce/plugins/legacyoutput';
import 'tinymce/plugins/link';
import 'tinymce/plugins/lists';
import 'tinymce/plugins/directionality';
import 'tinymce/themes/silver/theme';
import '@edx/tinymce-language-selector';
import 'tinymce/skins/ui/oxide/skin.css';
Expand Down Expand Up @@ -88,9 +89,10 @@ class RichEditor extends React.Component {
init={{
branding: false,
menubar: false,
plugins: 'legacyoutput link lists language',
plugins: 'legacyoutput link lists language directionality',
statusbar: false,
toolbar: 'undo redo | bold italic underline | bullist numlist | link | language',
selector: `#${id}`,
toolbar: 'undo redo | bold italic underline | bullist numlist | link | language | ltr rtl',
entity_encoding: 'raw',
extended_valid_elements: 'span[lang|id] -span',
content_css: false,
Expand Down

0 comments on commit 9e59252

Please sign in to comment.