AUI.add("aui-editor-menu-plugin",function(E){var L=E.Lang,B=L.isString,G=E.ClassNameManager.getClassName,Q="editormenu",D="editormenuplugin",N="menu",R="content",C=G(Q,R,"list"),I=G(Q,R,"text"),K=G(Q,R,"item"),O="<{1}{2}>{0}</{1}>",M='<li class="'+K+'">'+O+"</li>",F='<ul class="'+C+'"></ul>',J='<li class="'+I+'"><span>{0}</span></li>';var H=E.Component.create({NAME:Q,EXTENDS:E.OverlayContext,ATTRS:{headerContent:{value:"",setter:function(S){var A=this;A._headerContent=S;return"";}},host:{value:false},items:{value:null}},prototype:{renderUI:function(){var A=this;H.superclass.renderUI.apply(A,arguments);var X=A.get("host");var T=A.get("contentBox");var V=A._headerContent;var U=A.get("items");var W=E.Node.create(F);E.each(U,function(c,a,d){var Z="";if(B(c)){Z+=L.sub(J,[c]);}else{var Y=A._generateTagAttr(c);Z+=L.sub(M,[c.label,c.tag,Y]);}var b=E.Node.create(Z);b.setData(Q,c);W.append(b);});var S=new E.Panel({collapsible:false,headerContent:V,icons:[{icon:"close",handler:{fn:A.hide,context:A}}]}).render(T);S.bodyNode.append(W);A._menuList=W;},bindUI:function(){var A=this;H.superclass.bindUI.apply(A,arguments);A._menuList.delegate("click",A._onMenuListItemClick,"."+K,A);},_generateTagAttr:function(X){var A=this;var S=[];var U="";var T=X.attributes;var W=X.styles;if(T){for(var V in T){S.push(" "+V+'="'+T[V]+'"');}}if(W){S=[' style="'];for(var V in W){S.push(V+": "+W[V]+";");}S.push('"');}return S.join("");},_onMenuListItemClick:function(X){var S=this;var W=X.currentTarget;var U=W.getData(Q);var A=S._generateTagAttr(U);var T=L.sub(O,["{0}",U.tag,A]);var V=S.get("host");V.execCommand("wraphtml",T);V.focus();S.hide();},_uiSetHeight:function(U){var A=this;var S=A.get("boundingBox");var T=A._menuList;S.setStyle("height","auto");T.setStyle("height",U);},_uiSetWidth:function(U){var A=this;var S=A.get("boundingBox");var T=A._menuList;S.setStyle("width","auto");T.setStyle("width",U);}}});var P=E.Component.create({EXTENDS:E.Plugin.Base,NAME:D,NS:N,prototype:{add:function(S){var A=this;var T=A.get("host");return new H(E.mix({host:T},S)).render();}}});E.namespace("Plugin").EditorMenu=P;},"1.0.1",{requires:["aui-base","editor-base","aui-overlay-context","aui-panel","aui-editor-tools-plugin"]});