2 * editor_plugin_src.js
\r
4 * Copyright 2009, Moxiecode Systems AB
\r
5 * Released under LGPL License.
\r
7 * License: http://tinymce.moxiecode.com/license
\r
8 * Contributing: http://tinymce.moxiecode.com/contributing
\r
12 tinymce.create('tinymce.plugins.Directionality', {
\r
13 init : function(ed, url) {
\r
18 ed.addCommand('mceDirectionLTR', function() {
\r
19 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
\r
22 if (ed.dom.getAttrib(e, "dir") != "ltr")
\r
23 ed.dom.setAttrib(e, "dir", "ltr");
\r
25 ed.dom.setAttrib(e, "dir", "");
\r
31 ed.addCommand('mceDirectionRTL', function() {
\r
32 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
\r
35 if (ed.dom.getAttrib(e, "dir") != "rtl")
\r
36 ed.dom.setAttrib(e, "dir", "rtl");
\r
38 ed.dom.setAttrib(e, "dir", "");
\r
44 ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
\r
45 ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
\r
47 ed.onNodeChange.add(t._nodeChange, t);
\r
50 getInfo : function() {
\r
52 longname : 'Directionality',
\r
53 author : 'Moxiecode Systems AB',
\r
54 authorurl : 'http://tinymce.moxiecode.com',
\r
55 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
\r
56 version : tinymce.majorVersion + "." + tinymce.minorVersion
\r
62 _nodeChange : function(ed, cm, n) {
\r
63 var dom = ed.dom, dir;
\r
65 n = dom.getParent(n, dom.isBlock);
\r
67 cm.setDisabled('ltr', 1);
\r
68 cm.setDisabled('rtl', 1);
\r
72 dir = dom.getAttrib(n, 'dir');
\r
73 cm.setActive('ltr', dir == "ltr");
\r
74 cm.setDisabled('ltr', 0);
\r
75 cm.setActive('rtl', dir == "rtl");
\r
76 cm.setDisabled('rtl', 0);
\r
81 tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
\r