Important changes to Tiny Cloud pricing > Find out more

NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.

Directionality plugin

Toolbar buttons for setting the left-to-right or right-to-left direction of content.

Contribute to this page
+ toolbar button

This plugin adds directionality controls to the toolbar, enabling TinyMCE to better handle languages written from right to left. It also adds a toolbar button for each of its values, ltr for left-to-right text and rtl for right-to-left text.

Basic setup

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'directionality',
  toolbar: 'ltr rtl'
});

Toolbar buttons

The Directionality plugin provides the following toolbar buttons:

Toolbar button identifier Description
ltr Sets the directionality of contents to ltr.
rtl Sets the directionality of contents to rtl.

These toolbar buttons can be added to the editor using:

Commands

The Directionality plugin provides the following JavaScript commands.

Command Description
mceDirectionLTR Changes the directionality to LTR.
mceDirectionRTL Changes the directionality to RTL.

Examples

tinymce.activeEditor.execCommand('mceDirectionLTR');
tinymce.activeEditor.execCommand('mceDirectionRTL');

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.