YUI.add("moodle-atto_rtl-button",function(t,e){t.namespace("M.atto_rtl").Button=t.Base.create("button",t.M.editor_atto.EditorPlugin,[],{initializer:function(){var t;t="ltr",this.addButton({icon:"e/left_to_right",title:t,buttonName:t,callback:this._toggleRTL,callbackArgs:t,tags:"[dir=ltr]"}),t="rtl",this.addButton({icon:"e/right_to_left",title:t,buttonName:t,callback:this._toggleRTL,callbackArgs:t,tags:"[dir=rtl]"})},_toggleRTL:function(t,e){var i,l=this.get("host"),r=window.rangy.saveSelection(),o=l.getSelection(),a={rtl:"ltr",ltr:"rtl"},n={rtl:"right",ltr:"left"};o&&((i=l.formatSelectionBlock().getDOMNode()).getAttribute("dir")===e?(i.setAttribute("dir",a[e]),i.style.textAlign=n[a[e]]):(i.setAttribute("dir",e),i.style.textAlign=n[e]),window.rangy.restoreSelection(r),this.markUpdated())}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});