Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the directionality of different TinyMCE editors based on the direction attribute of the input they replace?

I have a page with multiple textareas to be replaced with TinyMCE. Some of the Textareas take arabic text, some english text. The textareas have the dir-attribute set correctly according to the input they should receive.

How can I set the directionality of the different Editors according to their textareas? I can set the directionality for all instances like this:

$('textarea.advanced_editor').tinymce({
    ⋮
    plugins : "…,directionality,…",
    directionality: "rtl",
    ⋮
});

But how can I set different direction for each editor?

like image 815
fragmentedreality Avatar asked Dec 09 '22 00:12

fragmentedreality


1 Answers

In this case you will need different tinymce configurations - one with directionality set to rtl the other with the default.

UPDATE:

This is possible. You need to call this using the correct editor id

tinymce.get('my_editor_id').getBody().dir ="rtl";
like image 96
Thariama Avatar answered Dec 28 '22 06:12

Thariama