MDL-66109 js: Upgrade to latest version of Shifter
[moodle.git] / lib / editor / atto / plugins / rtl / yui / build / moodle-atto_rtl-button / moodle-atto_rtl-button-min.js
CommitLineData
31d62654 1YUI.add("moodle-atto_rtl-button",function(e,t){e.namespace("M.atto_rtl").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){var e;e="ltr",this.addButton({icon:"e/left_to_right",title:e,buttonName:e,callback:this._toggleRTL,callbackArgs:e,tags:"[dir=ltr]"}),e="rtl",this.addButton({icon:"e/right_to_left",title:e,buttonName:e,callback:this._toggleRTL,callbackArgs:e,tags:"[dir=rtl]"})},_toggleRTL:function(e,t){var n=this.get("host"),r=window.rangy.saveSelection(),i=n.getSelection(),s={rtl:"ltr",ltr:"rtl"},o={rtl:"right",ltr:"left"};if(i){var u=n.formatSelectionBlock(),a=u.getDOMNode(),f=a.getAttribute("dir");f===t?(a.setAttribute("dir",s[t]),a.style.textAlign=o[s[t]]):(a.setAttribute("dir",t),a.style.textAlign=o[t]),window.rangy.restoreSelection(r),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});