]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/panelbutton/plugin.js
2 * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
6 CKEDITOR
.plugins
.add( 'panelbutton', {
9 function clickFn( editor
) {
12 if ( _
.state
== CKEDITOR
.TRISTATE_DISABLED
)
15 this.createPanel( editor
);
22 _
.panel
.showBlock( this._
.id
, this.document
.getById( this._
.id
), 4 );
27 * @extends CKEDITOR.ui.button
28 * @todo class and methods
30 CKEDITOR
.ui
.panelButton
= CKEDITOR
.tools
.createClass( {
31 base: CKEDITOR
.ui
.button
,
34 * Creates a panelButton class instance.
38 $: function( definition
) {
39 // We don't want the panel definition in this object.
40 var panelDefinition
= definition
.panel
|| {};
41 delete definition
.panel
;
43 this.base( definition
);
45 this.document
= ( panelDefinition
.parent
&& panelDefinition
.parent
.getDocument() ) || CKEDITOR
.document
;
47 panelDefinition
.block
= {
48 attributes: panelDefinition
.attributes
50 panelDefinition
.toolbarRelated
= true;
57 panelDefinition: panelDefinition
63 create: function( definition
) {
64 return new CKEDITOR
.ui
.panelButton( definition
);
70 createPanel: function( editor
) {
76 var panelDefinition
= this._
.panelDefinition
,
77 panelBlockDefinition
= this._
.panelDefinition
.block
,
78 panelParentElement
= panelDefinition
.parent
|| CKEDITOR
.document
.getBody(),
79 panel
= this._
.panel
= new CKEDITOR
.ui
.floatPanel( editor
, panelParentElement
, panelDefinition
),
80 block
= panel
.addBlock( _
.id
, panelBlockDefinition
),
83 panel
.onShow = function() {
85 this.element
.addClass( me
.className
+ '_panel' );
87 me
.setState( CKEDITOR
.TRISTATE_ON
);
91 me
.editorFocus
&& editor
.focus();
97 panel
.onHide = function( preventOnClose
) {
99 this.element
.getFirst().removeClass( me
.className
+ '_panel' );
101 me
.setState( me
.modes
&& me
.modes
[ editor
.mode
] ? CKEDITOR
.TRISTATE_OFF : CKEDITOR
.TRISTATE_DISABLED
);
105 if ( !preventOnClose
&& me
.onClose
)
109 panel
.onEscape = function() {
111 me
.document
.getById( _
.id
).focus();
115 this.onBlock( panel
, block
);
117 block
.onHide = function() {
119 me
.setState( CKEDITOR
.TRISTATE_OFF
);
126 beforeInit: function( editor
) {
127 editor
.ui
.addHandler( CKEDITOR
.UI_PANELBUTTON
, CKEDITOR
.ui
.panelButton
.handler
);
135 * @property {String} [='panelbutton']
138 CKEDITOR
.UI_PANELBUTTON
= 'panelbutton';