Set tinymce direction to rtl

In wordpress, the editor will support and will be in RTL by default if you install it in an rtl language, for example, if you install wordpress with the hebrew UI the editor will be rtl by default.

The problem is if you install the hebrew UI but change your profile to use the English one, in order to still use the editor in rtl mode while using the English UI you can add this code to functions.php or a site plugin:

function Eyal_setEditorToRTL($settings)
{
    $settings['directionality'] = 'rtl';
    return $settings;
}
add_filter('tiny_mce_before_init', 'Eyal_setEditorToRTL');

The filter alters the default settings for the tinyMCE editor and set it in rtl mode.