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="ltr";this.addButton({icon:"e/left_to_right",title:t,buttonName:t,callback:this._toggleRTL,callbackArgs:t,tags:"[dir=ltr]"}),this.addButton({icon:"e/right_to_left",title:t="rtl",buttonName:t,callback:this._toggleRTL,callbackArgs:t,tags:"[dir=rtl]"})},_toggleRTL:function(t,e){var i=this.get("host"),l=window.rangy.saveSelection(),r=i.getSelection(),o={rtl:"ltr",ltr:"rtl"},a={rtl:"right",ltr:"left"};r&&((r=i.formatSelectionBlock().getDOMNode()).getAttribute("dir")===e?(r.setAttribute("dir",o[e]),r.style.textAlign=a[o[e]]):(r.setAttribute("dir",e),r.style.textAlign=a[e]),window.rangy.restoreSelection(l),this.markUpdated())}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});