开发者

tinymce inst.directionality

开发者 https://www.devze.com 2023-01-21 03:47 出处:网络
I am stuck with an tiny issue with the tinyMce, and this is very urgent. In very brief, from tinyMce callback I get an tinyMce instance. Now I want to use this instance to set text-direction from \"lt

I am stuck with an tiny issue with the tinyMce, and this is very urgent. In very brief, from tinyMce callback I get an tinyMce instance. Now I want to use this instance to set text-direction from "ltr" to "开发者_运维问答rtl" on the fly. But I don't seem to find and set the required property. Following is what I'm trying to do :

$('textarea.tinymce').each(function () {
    $(this).tinymce({
       init_instance_callback : "setDirection"
    });
});

function setDirection(inst) {
      inst.directionality = "rtl";
}

Any help would be greatly appreciated.

Thanks.


First: init_instance_callback is deprecated as of TinyMCE3.x! You might want to use the setup callback option instead.

Second: You can use the following code to easily apply the direction you want:

editor.getBody().dir = 'rtl'; // editor is a tinymce editor instance


With TinyMCE v4.1.7, I added 'ltr' and 'tlr' option as toolbar for this small code modification required to be done in function LoadTinyMCE().

toolbar1: "ltr rtl | undo redo"
0

精彩评论

暂无评论...
验证码 换一张
取 消