2
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3
For licensing, see LICENSE.html or http://ckeditor.com/license
6
CKEDITOR.plugins.add( 'panelbutton',
8
requires : [ 'button' ],
9
beforeInit : function( editor )
11
editor.ui.addHandler( CKEDITOR.UI_PANELBUTTON, CKEDITOR.ui.panelButton.handler );
20
CKEDITOR.UI_PANELBUTTON = 4;
24
var clickFn = function( editor )
28
if ( _.state == CKEDITOR.TRISTATE_DISABLED )
31
this.createPanel( editor );
39
_.panel.showBlock( this._.id, this.document.getById( this._.id ), 4 );
43
CKEDITOR.ui.panelButton = CKEDITOR.tools.createClass(
45
base : CKEDITOR.ui.button,
47
$ : function( definition )
49
// We don't want the panel definition in this object.
50
var panelDefinition = definition.panel;
51
delete definition.panel;
53
this.base( definition );
55
this.document = ( panelDefinition
56
&& panelDefinition.parent
57
&& panelDefinition.parent.getDocument() )
66
panelDefinition : panelDefinition
74
create : function( definition )
76
return new CKEDITOR.ui.panelButton( definition );
83
createPanel : function( editor )
90
var panelDefinition = this._.panelDefinition || {},
91
panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(),
92
panel = this._.panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ),
95
panel.onShow = function()
98
this.element.getFirst().addClass( me.className + '_panel' );
100
_.oldState = me._.state;
101
me.setState( CKEDITOR.TRISTATE_ON );
109
panel.onHide = function()
112
this.element.getFirst().removeClass( me.className + '_panel' );
114
me.setState( _.oldState );
122
panel.onEscape = function()
125
me.document.getById( _.id ).focus();
129
this.onBlock( panel, _.id );
131
panel.getBlock( _.id ).onHide = function()
134
me.setState( CKEDITOR.TRISTATE_OFF );