YUI.add("moodle-atto_html-button",function(e,t){e.namespace("M.atto_html").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/source_code",callback:this._toggleHTML});var e=this.get("host").textarea.ancestor("form");e&&e.on("submit",this._submitClean,this)},_toggleHTML:function(){this.set("isHTML",!this.get("isHTML")),this._showHTML()},_showHTML:function(){var e=this.get("host");this.get("isHTML")?(this.highlightButtons("html"),e.disablePlugins(),e.enablePlugins(this.name),e.updateOriginal(),e.textarea.setStyles({width:this.editor.getComputedStyle("width"),height:this.editor.getComputedStyle("height"),margin:this.editor.getComputedStyle("margin"),padding:this.editor.getComputedStyle("padding")}),this.editor.hide(),e.textarea.show(),e.textarea.focus()):(this.unHighlightButtons("html"),e.enablePlugins(),e.updateFromTextArea(),e.textarea.hide(),this.editor.show(),e.focus(),this.markUpdated())},_submitClean:function(){if(this.get("isHTML")){var e=this.get("host");e.updateFromTextArea(),e.updateOriginal()}}},{ATTRS:{isHTML:{value:!1}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","event-valuechange"]});
