+++ /dev/null
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-CKEDITOR.plugins.add( 'panelbutton',\r
-{\r
- requires : [ 'button' ],\r
- onLoad : function()\r
- {\r
- function clickFn( editor )\r
- {\r
- var _ = this._;\r
-\r
- if ( _.state == CKEDITOR.TRISTATE_DISABLED )\r
- return;\r
-\r
- this.createPanel( editor );\r
-\r
- if ( _.on )\r
- {\r
- _.panel.hide();\r
- return;\r
- }\r
-\r
- _.panel.showBlock( this._.id, this.document.getById( this._.id ), 4 );\r
- }\r
-\r
- CKEDITOR.ui.panelButton = CKEDITOR.tools.createClass(\r
- {\r
- base : CKEDITOR.ui.button,\r
-\r
- $ : function( definition )\r
- {\r
- // We don't want the panel definition in this object.\r
- var panelDefinition = definition.panel;\r
- delete definition.panel;\r
-\r
- this.base( definition );\r
-\r
- this.document = ( panelDefinition\r
- && panelDefinition.parent\r
- && panelDefinition.parent.getDocument() )\r
- || CKEDITOR.document;\r
-\r
- panelDefinition.block =\r
- {\r
- attributes : panelDefinition.attributes\r
- };\r
-\r
- this.hasArrow = true;\r
-\r
- this.click = clickFn;\r
-\r
- this._ =\r
- {\r
- panelDefinition : panelDefinition\r
- };\r
- },\r
-\r
- statics :\r
- {\r
- handler :\r
- {\r
- create : function( definition )\r
- {\r
- return new CKEDITOR.ui.panelButton( definition );\r
- }\r
- }\r
- },\r
-\r
- proto :\r
- {\r
- createPanel : function( editor )\r
- {\r
- var _ = this._;\r
-\r
- if ( _.panel )\r
- return;\r
-\r
- var panelDefinition = this._.panelDefinition || {},\r
- panelBlockDefinition = this._.panelDefinition.block,\r
- panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(),\r
- panel = this._.panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ),\r
- block = panel.addBlock( _.id, panelBlockDefinition ),\r
- me = this;\r
-\r
- panel.onShow = function()\r
- {\r
- if ( me.className )\r
- this.element.getFirst().addClass( me.className + '_panel' );\r
-\r
- me.setState( CKEDITOR.TRISTATE_ON );\r
-\r
- _.on = 1;\r
-\r
- if ( me.onOpen )\r
- me.onOpen();\r
- };\r
-\r
- panel.onHide = function( preventOnClose )\r
- {\r
- if ( me.className )\r
- this.element.getFirst().removeClass( me.className + '_panel' );\r
-\r
- me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );\r
-\r
- _.on = 0;\r
-\r
- if ( !preventOnClose && me.onClose )\r
- me.onClose();\r
- };\r
-\r
- panel.onEscape = function()\r
- {\r
- panel.hide();\r
- me.document.getById( _.id ).focus();\r
- };\r
-\r
- if ( this.onBlock )\r
- this.onBlock( panel, block );\r
-\r
- block.onHide = function()\r
- {\r
- _.on = 0;\r
- me.setState( CKEDITOR.TRISTATE_OFF );\r
- };\r
- }\r
- }\r
- });\r
-\r
- },\r
- beforeInit : function( editor )\r
- {\r
- editor.ui.addHandler( CKEDITOR.UI_PANELBUTTON, CKEDITOR.ui.panelButton.handler );\r
- }\r
-});\r
-\r
-/**\r
- * Button UI element.\r
- * @constant\r
- * @example\r
- */\r
-CKEDITOR.UI_PANELBUTTON = 'panelbutton';\r