51d0be479a8b535f64e41f9944cee8f4206b7b77
[moodle.git] / lib / editor / atto / plugins / rtl / yui / build / moodle-atto_rtl-button / moodle-atto_rtl-button-min.js
1 YUI.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}),e="rtl",this.addButton({icon:"e/right_to_left",title:e,buttonName:e,callback:this._toggleRTL,callbackArgs:e})},_toggleRTL:function(e,t){var n=this.get("host"),r=rangy.saveSelection(),i=n.getSelection(),s={rtl:"ltr",ltr:"rtl"};if(i){var o=n.formatSelectionBlock(),u=o.getDOMNode(),a=u.getAttribute("dir");a===t?u.setAttribute("dir",s[t]):u.setAttribute("dir",t),rangy.restoreSelection(r),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});