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