CKEDITOR.plugins.add('panelbutton',{requires:['button'],beforeInit:function(a){a.ui.addHandler(CKEDITOR.UI_PANELBUTTON,CKEDITOR.ui.panelButton.handler);}});CKEDITOR.UI_PANELBUTTON=4;(function(){var a=function(b){var d=this;var c=d._;if(c.state==CKEDITOR.TRISTATE_DISABLED)return;d.createPanel(b);if(c.on){c.panel.hide();return;}c.panel.showBlock(d._.id,d.document.getById(d._.id),4);};CKEDITOR.ui.panelButton=CKEDITOR.tools.createClass({base:CKEDITOR.ui.button,$:function(b){var d=this;var c=b.panel;delete b.panel;d.base(b);d.document=c&&c.parent&&c.parent.getDocument()||CKEDITOR.document;c.block={attributes:c.attributes};d.hasArrow=true;d.click=a;d._={panelDefinition:c};},statics:{handler:{create:function(b){return new CKEDITOR.ui.panelButton(b);}}},proto:{createPanel:function(b){var c=this._;if(c.panel)return;var d=this._.panelDefinition||{},e=this._.panelDefinition.block,f=d.parent||CKEDITOR.document.getBody(),g=this._.panel=new CKEDITOR.ui.floatPanel(b,f,d),h=g.addBlock(c.id,e),i=this;g.onShow=function(){if(i.className)this.element.getFirst().addClass(i.className+'_panel');c.oldState=i._.state;i.setState(CKEDITOR.TRISTATE_ON);c.on=1;if(i.onOpen)i.onOpen();};g.onHide=function(){if(i.className)this.element.getFirst().removeClass(i.className+'_panel');i.setState(c.oldState);c.on=0;if(i.onClose)i.onClose();};g.onEscape=function(){g.hide();i.document.getById(c.id).focus();};if(this.onBlock)this.onBlock(g,h);h.onHide=function(){c.on=0;i.setState(CKEDITOR.TRISTATE_OFF);};}}});})();
