YUI.add("moodle-atto_indent-button",function(r,e){r.namespace("M.atto_indent").Button=r.Base.create("button",r.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/decrease_indent",title:"outdent",buttonName:"outdent",callback:this.outdent}),this.addButton({icon:"e/increase_indent",title:"indent",buttonName:"indent",callback:this.indent})},indent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),o=t.size();this.editor.all(".rangySelectionBoundary").setStyle("display",null),t.addClass("pre-existing"),document.execCommand("indent",!1,null),(t=this.editor.all("blockquote")).size()!==o?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):0<t.size()&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},outdent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),o=t.size();t.addClass("pre-existing"),this.replaceEditorIndents(this.editor),window.rangy.restoreSelection(e),e=window.rangy.saveSelection(),document.execCommand("outdent",!1,null),(t=this.editor.all("blockquote")).size()!==o?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):0<t.size()&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},replaceBlockquote:function(e){var t,o,i,n,d;for(e.all("blockquote").setAttribute("data-iterate",!0),t=e.one("blockquote"),o=r.one("body.dir-ltr")?"marginLeft":"marginRight";t;){if(t.removeAttribute("data-iterate"),t.hasClass("pre-existing"))t.removeClass("pre-existing");else{for(i=r.Node.create("<div></div>").setAttrs(t.getAttrs()).setStyle(o,"30px").addClass("editor-indent"),d=(n=t.getDOMNode().childNodes)[0];void 0!==d;)i.append(d),d=n[0];t.replace(i)}t=e.one("blockquote[data-iterate]")}},replaceEditorIndents:function(e){for(var t,o,i,n=e.one(".editor-indent");n;){for(t=r.Node.create("<blockquote></blockquote>").setAttrs(n.getAttrs()).removeClass("editor-indent"),i=(o=n.getDOMNode().childNodes)[0];void 0!==i;)t.append(i),i=o[0];n.replace(t),n=e.one(".editor-indent")}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});