tinymce.create("tinymce.plugins.Directionality",{init:function(t,e){var i=this;function n(e){var i,n=t.dom,r=t.selection.getSelectedBlocks();r.length&&(i=n.getAttrib(r[0],"dir"),tinymce.each(r,(function(t){n.getParent(t.parentNode,"*[dir='"+e+"']",n.getRoot())||(i!=e?n.setAttrib(t,"dir",e):n.setAttrib(t,"dir",null))})),t.nodeChanged())}i.editor=t,t.addCommand("mceDirectionLTR",(function(){n("ltr")})),t.addCommand("mceDirectionRTL",(function(){n("rtl")})),t.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"}),t.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"}),t.onNodeChange.add(i._nodeChange,i)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(t,e,i){var n,r=t.dom;if(!(i=r.getParent(i,r.isBlock)))return e.setDisabled("ltr",1),void e.setDisabled("rtl",1);n=r.getAttrib(i,"dir"),e.setActive("ltr","ltr"==n),e.setDisabled("ltr",0),e.setActive("rtl","rtl"==n),e.setDisabled("rtl",0)}}),tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality);
