Is there any way to change the directionality of a textarea that is connected to a TinyMCE toolbar, by directly using the same commands that are created in plugins? What I mean is, I want to programmatically run the RTL directionality without actually clicking on the toolbar's icon.
In the source code of the directionality
plugin, the following code is included:
ed.addCommand('mceDirectionRTL', function() {
setDir("rtl");
});
This means that mceDirectionRTL
is a command. Can I use it directly in the code? I tried but it isn't recognized.
The reason I'm asking is that I want to run this command AFTER a tinyMCE instance is started, not during the initialization/setup function of the TinyMCE toolbar. I have a bunch of texraeas, some are english and some have the class ar
to denote they are for Arabic, which is RTL.
But when I do this:
$('ID of my textarea'_ifr').contents().find('body').attr('dir', 'rtl');
Then everything is fine except that the mceExternalToolbar
(the whole toolbar!) not just the textarea, becomes rtl. So the external toolbar basically goes out of place, and leans to the right side of the page. But I only want the textarea that it is connected to to have RTL text, not the whole toolbar!
So I want to somehow externally simulate clicking the RTL button on the toolbar AFTER the toolbar is instantiated. Is this possible?
Set and redraw may be a solution:
http://www.tinymce.com/forum/viewtopic.php?id=9735
tinyMCE.settings['directionality'] = 'rtl';
tinyMCE.execCommand( 'mceRemoveControl', false, 'editor );
tinyMCE.execCommand( 'mceAddControl', false, 'editor );