2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
9 tinymce
.create('tinymce.plugins.Directionality', {
10 init : function(ed
, url
) {
15 ed
.addCommand('mceDirectionLTR', function() {
16 var e
= ed
.dom
.getParent(ed
.selection
.getNode(), ed
.dom
.isBlock
);
19 if (ed
.dom
.getAttrib(e
, "dir") != "ltr")
20 ed
.dom
.setAttrib(e
, "dir", "ltr");
22 ed
.dom
.setAttrib(e
, "dir", "");
28 ed
.addCommand('mceDirectionRTL', function() {
29 var e
= ed
.dom
.getParent(ed
.selection
.getNode(), ed
.dom
.isBlock
);
32 if (ed
.dom
.getAttrib(e
, "dir") != "rtl")
33 ed
.dom
.setAttrib(e
, "dir", "rtl");
35 ed
.dom
.setAttrib(e
, "dir", "");
41 ed
.addButton('ltr', {title
: 'directionality.ltr_desc', cmd
: 'mceDirectionLTR'});
42 ed
.addButton('rtl', {title
: 'directionality.rtl_desc', cmd
: 'mceDirectionRTL'});
44 ed
.onNodeChange
.add(t
._nodeChange
, t
);
47 getInfo : function() {
49 longname
: 'Directionality',
50 author
: 'Moxiecode Systems AB',
51 authorurl
: 'http://tinymce.moxiecode.com',
52 infourl
: 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
53 version
: tinymce
.majorVersion
+ "." + tinymce
.minorVersion
59 _nodeChange : function(ed
, cm
, n
) {
60 var dom
= ed
.dom
, dir
;
62 n
= dom
.getParent(n
, dom
.isBlock
);
64 cm
.setDisabled('ltr', 1);
65 cm
.setDisabled('rtl', 1);
69 dir
= dom
.getAttrib(n
, 'dir');
70 cm
.setActive('ltr', dir
== "ltr");
71 cm
.setDisabled('ltr', 0);
72 cm
.setActive('rtl', dir
== "rtl");
73 cm
.setDisabled('rtl', 0);
78 tinymce
.PluginManager
.add('directionality', tinymce
.plugins
.Directionality
);