]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/menubutton/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( 'menubutton', {
7 requires: 'button,menu',
9 var clickFn = function( editor
) {
13 // Do nothing if this button is disabled.
14 if ( _
.state
=== CKEDITOR
.TRISTATE_DISABLED
)
22 _
.previousState
= _
.state
;
24 // Check if we already have a menu for it, otherwise just create it.
26 menu
= _
.menu
= new CKEDITOR
.menu( editor
, {
28 className: 'cke_menu_panel',
29 attributes: { 'aria-label': editor
.lang
.common
.options
}
33 menu
.onHide
= CKEDITOR
.tools
.bind( function() {
34 var modes
= this.command
? editor
.getCommand( this.command
).modes : this.modes
;
35 this.setState( !modes
|| modes
[ editor
.mode
] ? _
.previousState : CKEDITOR
.TRISTATE_DISABLED
);
39 // Initialize the menu items at this point.
41 menu
.addListener( this.onMenu
);
44 this.setState( CKEDITOR
.TRISTATE_ON
);
47 // This timeout is needed to give time for the panel get focus
48 // when JAWS is running. (#9842)
49 setTimeout( function() {
50 menu
.show( CKEDITOR
.document
.getById( _
.id
), 4 );
56 * @extends CKEDITOR.ui.button
59 CKEDITOR
.ui
.menuButton
= CKEDITOR
.tools
.createClass( {
60 base: CKEDITOR
.ui
.button
,
63 * Creates a menuButton class instance.
66 * @param Object definition
69 $: function( definition
) {
70 // We don't want the panel definition in this object.
71 delete definition
.panel
;
73 this.base( definition
);
82 create: function( definition
) {
83 return new CKEDITOR
.ui
.menuButton( definition
);
89 beforeInit: function( editor
) {
90 editor
.ui
.addHandler( CKEDITOR
.UI_MENUBUTTON
, CKEDITOR
.ui
.menuButton
.handler
);
98 * @property {String} [='menubutton']
101 CKEDITOR
.UI_MENUBUTTON
= 'menubutton';