]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blob - sources/plugins/toolbar/plugin.js
Update to 4.7.3
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / toolbar / plugin.js
1 /**
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5
6 /**
7 * @fileOverview The "toolbar" plugin. Renders the default toolbar interface in
8 * the editor.
9 */
10
11 ( function() {
12 var toolbox = function() {
13 this.toolbars = [];
14 this.focusCommandExecuted = false;
15 };
16
17 toolbox.prototype.focus = function() {
18 for ( var t = 0, toolbar; toolbar = this.toolbars[ t++ ]; ) {
19 for ( var i = 0, item; item = toolbar.items[ i++ ]; ) {
20 if ( item.focus ) {
21 item.focus();
22 return;
23 }
24 }
25 }
26 };
27
28 var commands = {
29 toolbarFocus: {
30 modes: { wysiwyg: 1, source: 1 },
31 readOnly: 1,
32
33 exec: function( editor ) {
34 if ( editor.toolbox ) {
35 editor.toolbox.focusCommandExecuted = true;
36
37 // Make the first button focus accessible for IE. (http://dev.ckeditor.com/ticket/3417)
38 // Adobe AIR instead need while of delay.
39 if ( CKEDITOR.env.ie || CKEDITOR.env.air ) {
40 setTimeout( function() {
41 editor.toolbox.focus();
42 }, 100 );
43 } else {
44 editor.toolbox.focus();
45 }
46 }
47 }
48 }
49 };
50
51 CKEDITOR.plugins.add( 'toolbar', {
52 requires: 'button',
53 // jscs:disable maximumLineLength
54 lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
55 // jscs:enable maximumLineLength
56
57 init: function( editor ) {
58 var endFlag;
59
60 var itemKeystroke = function( item, keystroke ) {
61 var next, toolbar;
62 var rtl = editor.lang.dir == 'rtl',
63 toolbarGroupCycling = editor.config.toolbarGroupCycling,
64 // Picking right/left key codes.
65 rightKeyCode = rtl ? 37 : 39,
66 leftKeyCode = rtl ? 39 : 37;
67
68 toolbarGroupCycling = toolbarGroupCycling === undefined || toolbarGroupCycling;
69
70 switch ( keystroke ) {
71 case 9: // TAB
72 case CKEDITOR.SHIFT + 9: // SHIFT + TAB
73 // Cycle through the toolbars, starting from the one
74 // closest to the current item.
75 while ( !toolbar || !toolbar.items.length ) {
76 if ( keystroke == 9 ) {
77 toolbar = ( ( toolbar ? toolbar.next : item.toolbar.next ) || editor.toolbox.toolbars[ 0 ] );
78 } else {
79 toolbar = ( ( toolbar ? toolbar.previous : item.toolbar.previous ) || editor.toolbox.toolbars[ editor.toolbox.toolbars.length - 1 ] );
80 }
81
82 // Look for the first item that accepts focus.
83 if ( toolbar.items.length ) {
84 item = toolbar.items[ endFlag ? ( toolbar.items.length - 1 ) : 0 ];
85 while ( item && !item.focus ) {
86 item = endFlag ? item.previous : item.next;
87
88 if ( !item )
89 toolbar = 0;
90 }
91 }
92 }
93
94 if ( item )
95 item.focus();
96
97 return false;
98
99 case rightKeyCode:
100 next = item;
101 do {
102 // Look for the next item in the toolbar.
103 next = next.next;
104
105 // If it's the last item, cycle to the first one.
106 if ( !next && toolbarGroupCycling ) next = item.toolbar.items[ 0 ];
107 }
108 while ( next && !next.focus );
109
110 // If available, just focus it, otherwise focus the
111 // first one.
112 if ( next )
113 next.focus();
114 else
115 // Send a TAB.
116 itemKeystroke( item, 9 );
117
118 return false;
119 case 40: // DOWN-ARROW
120 if ( item.button && item.button.hasArrow ) {
121 item.execute();
122 } else {
123 // Send left arrow key.
124 itemKeystroke( item, keystroke == 40 ? rightKeyCode : leftKeyCode );
125 }
126 return false;
127 case leftKeyCode:
128 case 38: // UP-ARROW
129 next = item;
130 do {
131 // Look for the previous item in the toolbar.
132 next = next.previous;
133
134 // If it's the first item, cycle to the last one.
135 if ( !next && toolbarGroupCycling ) next = item.toolbar.items[ item.toolbar.items.length - 1 ];
136 }
137 while ( next && !next.focus );
138
139 // If available, just focus it, otherwise focus the
140 // last one.
141 if ( next )
142 next.focus();
143 else {
144 endFlag = 1;
145 // Send a SHIFT + TAB.
146 itemKeystroke( item, CKEDITOR.SHIFT + 9 );
147 endFlag = 0;
148 }
149
150 return false;
151
152 case 27: // ESC
153 editor.focus();
154 return false;
155
156 case 13: // ENTER
157 case 32: // SPACE
158 item.execute();
159 return false;
160 }
161 return true;
162 };
163
164 editor.on( 'uiSpace', function( event ) {
165 if ( event.data.space != editor.config.toolbarLocation )
166 return;
167
168 // Create toolbar only once.
169 event.removeListener();
170
171 editor.toolbox = new toolbox();
172
173 var labelId = CKEDITOR.tools.getNextId();
174
175 var output = [
176 '<span id="', labelId, '" class="cke_voice_label">', editor.lang.toolbar.toolbars, '</span>',
177 '<span id="' + editor.ui.spaceId( 'toolbox' ) + '" class="cke_toolbox" role="group" aria-labelledby="', labelId, '" onmousedown="return false;">'
178 ];
179
180 var expanded = editor.config.toolbarStartupExpanded !== false,
181 groupStarted, pendingSeparator;
182
183 // If the toolbar collapser will be available, we'll have
184 // an additional container for all toolbars.
185 if ( editor.config.toolbarCanCollapse && editor.elementMode != CKEDITOR.ELEMENT_MODE_INLINE )
186 output.push( '<span class="cke_toolbox_main"' + ( expanded ? '>' : ' style="display:none">' ) );
187
188 var toolbars = editor.toolbox.toolbars,
189 toolbar = getToolbarConfig( editor ),
190 toolbarLength = toolbar.length;
191
192 for ( var r = 0; r < toolbarLength; r++ ) {
193 var toolbarId,
194 toolbarObj = 0,
195 toolbarName,
196 row = toolbar[ r ],
197 lastToolbarInRow = row !== '/' && ( toolbar[ r + 1 ] === '/' || r == toolbarLength - 1 ),
198 items;
199
200 // It's better to check if the row object is really
201 // available because it's a common mistake to leave
202 // an extra comma in the toolbar definition
203 // settings, which leads on the editor not loading
204 // at all in IE. (http://dev.ckeditor.com/ticket/3983)
205 if ( !row )
206 continue;
207
208 if ( groupStarted ) {
209 output.push( '</span>' );
210 groupStarted = 0;
211 pendingSeparator = 0;
212 }
213
214 if ( row === '/' ) {
215 output.push( '<span class="cke_toolbar_break"></span>' );
216 continue;
217 }
218
219 items = row.items || row;
220
221 // Create all items defined for this toolbar.
222 for ( var i = 0; i < items.length; i++ ) {
223 var item = items[ i ],
224 canGroup;
225
226 if ( item ) {
227 if ( item.type == CKEDITOR.UI_SEPARATOR ) {
228 // Do not add the separator immediately. Just save
229 // it be included if we already have something in
230 // the toolbar and if a new item is to be added (later).
231 pendingSeparator = groupStarted && item;
232 continue;
233 }
234
235 canGroup = item.canGroup !== false;
236
237 // Initialize the toolbar first, if needed.
238 if ( !toolbarObj ) {
239 // Create the basic toolbar object.
240 toolbarId = CKEDITOR.tools.getNextId();
241 toolbarObj = { id: toolbarId, items: [] };
242 toolbarName = row.name && ( editor.lang.toolbar.toolbarGroups[ row.name ] || row.name );
243
244 // Output the toolbar opener.
245 output.push( '<span id="', toolbarId, '" class="cke_toolbar' + ( lastToolbarInRow ? ' cke_toolbar_last"' : '"' ),
246 ( toolbarName ? ' aria-labelledby="' + toolbarId + '_label"' : '' ), ' role="toolbar">' );
247
248 // If a toolbar name is available, send the voice label.
249 toolbarName && output.push( '<span id="', toolbarId, '_label" class="cke_voice_label">', toolbarName, '</span>' );
250
251 output.push( '<span class="cke_toolbar_start"></span>' );
252
253 // Add the toolbar to the "editor.toolbox.toolbars"
254 // array.
255 var index = toolbars.push( toolbarObj ) - 1;
256
257 // Create the next/previous reference.
258 if ( index > 0 ) {
259 toolbarObj.previous = toolbars[ index - 1 ];
260 toolbarObj.previous.next = toolbarObj;
261 }
262 }
263
264 if ( canGroup ) {
265 if ( !groupStarted ) {
266 output.push( '<span class="cke_toolgroup" role="presentation">' );
267 groupStarted = 1;
268 }
269 } else if ( groupStarted ) {
270 output.push( '</span>' );
271 groupStarted = 0;
272 }
273
274 function addItem( item ) { // jshint ignore:line
275 var itemObj = item.render( editor, output );
276 index = toolbarObj.items.push( itemObj ) - 1;
277
278 if ( index > 0 ) {
279 itemObj.previous = toolbarObj.items[ index - 1 ];
280 itemObj.previous.next = itemObj;
281 }
282
283 itemObj.toolbar = toolbarObj;
284 itemObj.onkey = itemKeystroke;
285
286 // Fix for http://dev.ckeditor.com/ticket/3052:
287 // Prevent JAWS from focusing the toolbar after document load.
288 itemObj.onfocus = function() {
289 if ( !editor.toolbox.focusCommandExecuted )
290 editor.focus();
291 };
292 }
293
294 if ( pendingSeparator ) {
295 addItem( pendingSeparator );
296 pendingSeparator = 0;
297 }
298
299 addItem( item );
300 }
301 }
302
303 if ( groupStarted ) {
304 output.push( '</span>' );
305 groupStarted = 0;
306 pendingSeparator = 0;
307 }
308
309 if ( toolbarObj )
310 output.push( '<span class="cke_toolbar_end"></span></span>' );
311 }
312
313 if ( editor.config.toolbarCanCollapse )
314 output.push( '</span>' );
315
316 // Not toolbar collapser for inline mode.
317 if ( editor.config.toolbarCanCollapse && editor.elementMode != CKEDITOR.ELEMENT_MODE_INLINE ) {
318 var collapserFn = CKEDITOR.tools.addFunction( function() {
319 editor.execCommand( 'toolbarCollapse' );
320 } );
321
322 editor.on( 'destroy', function() {
323 CKEDITOR.tools.removeFunction( collapserFn );
324 } );
325
326 editor.addCommand( 'toolbarCollapse', {
327 readOnly: 1,
328 exec: function( editor ) {
329 var collapser = editor.ui.space( 'toolbar_collapser' ),
330 toolbox = collapser.getPrevious(),
331 contents = editor.ui.space( 'contents' ),
332 toolboxContainer = toolbox.getParent(),
333 contentHeight = parseInt( contents.$.style.height, 10 ),
334 previousHeight = toolboxContainer.$.offsetHeight,
335 minClass = 'cke_toolbox_collapser_min',
336 collapsed = collapser.hasClass( minClass );
337
338 if ( !collapsed ) {
339 toolbox.hide();
340 collapser.addClass( minClass );
341 collapser.setAttribute( 'title', editor.lang.toolbar.toolbarExpand );
342 } else {
343 toolbox.show();
344 collapser.removeClass( minClass );
345 collapser.setAttribute( 'title', editor.lang.toolbar.toolbarCollapse );
346 }
347
348 // Update collapser symbol.
349 collapser.getFirst().setText( collapsed ? '\u25B2' : // BLACK UP-POINTING TRIANGLE
350 '\u25C0' ); // BLACK LEFT-POINTING TRIANGLE
351
352 var dy = toolboxContainer.$.offsetHeight - previousHeight;
353 contents.setStyle( 'height', ( contentHeight - dy ) + 'px' );
354
355 editor.fire( 'resize', {
356 outerHeight: editor.container.$.offsetHeight,
357 contentsHeight: contents.$.offsetHeight,
358 outerWidth: editor.container.$.offsetWidth
359 } );
360 },
361
362 modes: { wysiwyg: 1, source: 1 }
363 } );
364
365 editor.setKeystroke( CKEDITOR.ALT + ( CKEDITOR.env.ie || CKEDITOR.env.webkit ? 189 : 109 ) /*-*/, 'toolbarCollapse' );
366
367 output.push( '<a title="' + ( expanded ? editor.lang.toolbar.toolbarCollapse : editor.lang.toolbar.toolbarExpand ) +
368 '" id="' + editor.ui.spaceId( 'toolbar_collapser' ) +
369 '" tabIndex="-1" class="cke_toolbox_collapser' );
370
371 if ( !expanded )
372 output.push( ' cke_toolbox_collapser_min' );
373
374 output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ')">', '<span class="cke_arrow">&#9650;</span>', // BLACK UP-POINTING TRIANGLE
375 '</a>' );
376 }
377
378 output.push( '</span>' );
379 event.data.html += output.join( '' );
380 } );
381
382 editor.on( 'destroy', function() {
383 if ( this.toolbox ) {
384 var toolbars,
385 index = 0,
386 i, items, instance;
387 toolbars = this.toolbox.toolbars;
388 for ( ; index < toolbars.length; index++ ) {
389 items = toolbars[ index ].items;
390 for ( i = 0; i < items.length; i++ ) {
391 instance = items[ i ];
392 if ( instance.clickFn )
393 CKEDITOR.tools.removeFunction( instance.clickFn );
394 if ( instance.keyDownFn )
395 CKEDITOR.tools.removeFunction( instance.keyDownFn );
396 }
397 }
398 }
399 } );
400
401 // Manage editor focus when navigating the toolbar.
402 editor.on( 'uiReady', function() {
403 var toolbox = editor.ui.space( 'toolbox' );
404 toolbox && editor.focusManager.add( toolbox, 1 );
405 } );
406
407 editor.addCommand( 'toolbarFocus', commands.toolbarFocus );
408 editor.setKeystroke( CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' );
409
410 editor.ui.add( '-', CKEDITOR.UI_SEPARATOR, {} );
411 editor.ui.addHandler( CKEDITOR.UI_SEPARATOR, {
412 create: function() {
413 return {
414 render: function( editor, output ) {
415 output.push( '<span class="cke_toolbar_separator" role="separator"></span>' );
416 return {};
417 }
418 };
419 }
420 } );
421 }
422 } );
423
424 function getToolbarConfig( editor ) {
425 var removeButtons = editor.config.removeButtons;
426
427 removeButtons = removeButtons && removeButtons.split( ',' );
428
429 function buildToolbarConfig() {
430
431 // Object containing all toolbar groups used by ui items.
432 var lookup = getItemDefinedGroups();
433
434 // Take the base for the new toolbar, which is basically a toolbar
435 // definition without items.
436 var toolbar = CKEDITOR.tools.clone( editor.config.toolbarGroups ) || getPrivateToolbarGroups( editor );
437
438 // Fill the toolbar groups with the available ui items.
439 for ( var i = 0; i < toolbar.length; i++ ) {
440 var toolbarGroup = toolbar[ i ];
441
442 // Skip toolbar break.
443 if ( toolbarGroup == '/' )
444 continue;
445 // Handle simply group name item.
446 else if ( typeof toolbarGroup == 'string' )
447 toolbarGroup = toolbar[ i ] = { name: toolbarGroup };
448
449 var items, subGroups = toolbarGroup.groups;
450
451 // Look for items that match sub groups.
452 if ( subGroups ) {
453 for ( var j = 0, sub; j < subGroups.length; j++ ) {
454 sub = subGroups[ j ];
455
456 // If any ui item is registered for this subgroup.
457 items = lookup[ sub ];
458 items && fillGroup( toolbarGroup, items );
459 }
460 }
461
462 // Add the main group items as well.
463 items = lookup[ toolbarGroup.name ];
464 items && fillGroup( toolbarGroup, items );
465 }
466
467 return toolbar;
468 }
469
470 // Returns an object containing all toolbar groups used by ui items.
471 function getItemDefinedGroups() {
472 var groups = {},
473 itemName, item, itemToolbar, group, order;
474
475 for ( itemName in editor.ui.items ) {
476 item = editor.ui.items[ itemName ];
477 itemToolbar = item.toolbar || 'others';
478 if ( itemToolbar ) {
479 // Break the toolbar property into its parts: "group_name[,order]".
480 itemToolbar = itemToolbar.split( ',' );
481 group = itemToolbar[ 0 ];
482 order = parseInt( itemToolbar[ 1 ] || -1, 10 );
483
484 // Initialize the group, if necessary.
485 groups[ group ] || ( groups[ group ] = [] );
486
487 // Push the data used to build the toolbar later.
488 groups[ group ].push( { name: itemName, order: order } );
489 }
490 }
491
492 // Put the items in the right order.
493 for ( group in groups ) {
494 groups[ group ] = groups[ group ].sort( function( a, b ) {
495 return a.order == b.order ? 0 :
496 b.order < 0 ? -1 :
497 a.order < 0 ? 1 :
498 a.order < b.order ? -1 :
499 1;
500 } );
501 }
502
503 return groups;
504 }
505
506 function fillGroup( toolbarGroup, uiItems ) {
507 if ( uiItems.length ) {
508 if ( toolbarGroup.items )
509 toolbarGroup.items.push( editor.ui.create( '-' ) );
510 else
511 toolbarGroup.items = [];
512
513 var item, name;
514 while ( ( item = uiItems.shift() ) ) {
515 name = typeof item == 'string' ? item : item.name;
516
517 // Ignore items that are configured to be removed.
518 if ( !removeButtons || CKEDITOR.tools.indexOf( removeButtons, name ) == -1 ) {
519 item = editor.ui.create( name );
520
521 if ( !item )
522 continue;
523
524 if ( !editor.addFeature( item ) )
525 continue;
526
527 toolbarGroup.items.push( item );
528 }
529 }
530 }
531 }
532
533 function populateToolbarConfig( config ) {
534 var toolbar = [],
535 i, group, newGroup;
536
537 for ( i = 0; i < config.length; ++i ) {
538 group = config[ i ];
539 newGroup = {};
540
541 if ( group == '/' )
542 toolbar.push( group );
543 else if ( CKEDITOR.tools.isArray( group ) ) {
544 fillGroup( newGroup, CKEDITOR.tools.clone( group ) );
545 toolbar.push( newGroup );
546 }
547 else if ( group.items ) {
548 fillGroup( newGroup, CKEDITOR.tools.clone( group.items ) );
549 newGroup.name = group.name;
550 toolbar.push( newGroup );
551 }
552 }
553
554 return toolbar;
555 }
556
557 var toolbar = editor.config.toolbar;
558
559 // If it is a string, return the relative "toolbar_name" config.
560 if ( typeof toolbar == 'string' )
561 toolbar = editor.config[ 'toolbar_' + toolbar ];
562
563 return ( editor.toolbar = toolbar ? populateToolbarConfig( toolbar ) : buildToolbarConfig() );
564 }
565
566 /**
567 * Adds a toolbar group. See {@link CKEDITOR.config#toolbarGroups} for more details.
568 *
569 * **Note:** This method will not modify toolbar groups set explicitly by
570 * {@link CKEDITOR.config#toolbarGroups}. It will only extend the default setting.
571 *
572 * @param {String} name Toolbar group name.
573 * @param {Number/String} previous The name of the toolbar group after which this one
574 * should be added or `0` if this group should be the first one.
575 * @param {String} [subgroupOf] The name of the parent group.
576 * @member CKEDITOR.ui
577 */
578 CKEDITOR.ui.prototype.addToolbarGroup = function( name, previous, subgroupOf ) {
579 // The toolbarGroups from the privates is the one we gonna use for automatic toolbar creation.
580 var toolbarGroups = getPrivateToolbarGroups( this.editor ),
581 atStart = previous === 0,
582 newGroup = { name: name };
583
584 if ( subgroupOf ) {
585 // Transform the subgroupOf name in the real subgroup object.
586 subgroupOf = CKEDITOR.tools.search( toolbarGroups, function( group ) {
587 return group.name == subgroupOf;
588 } );
589
590 if ( subgroupOf ) {
591 !subgroupOf.groups && ( subgroupOf.groups = [] ) ;
592
593 if ( previous ) {
594 // Search the "previous" item and add the new one after it.
595 previous = CKEDITOR.tools.indexOf( subgroupOf.groups, previous );
596 if ( previous >= 0 ) {
597 subgroupOf.groups.splice( previous + 1, 0, name );
598 return;
599 }
600 }
601
602 // If no previous found.
603
604 if ( atStart )
605 subgroupOf.groups.splice( 0, 0, name );
606 else
607 subgroupOf.groups.push( name );
608 return;
609 } else {
610 // Ignore "previous" if subgroupOf has not been found.
611 previous = null;
612 }
613 }
614
615 if ( previous ) {
616 // Transform the "previous" name into its index.
617 previous = CKEDITOR.tools.indexOf( toolbarGroups, function( group ) {
618 return group.name == previous;
619 } );
620 }
621
622 if ( atStart )
623 toolbarGroups.splice( 0, 0, name );
624 else if ( typeof previous == 'number' )
625 toolbarGroups.splice( previous + 1, 0, newGroup );
626 else
627 toolbarGroups.push( name );
628 };
629
630 function getPrivateToolbarGroups( editor ) {
631 return editor._.toolbarGroups || ( editor._.toolbarGroups = [
632 { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
633 { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
634 { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
635 { name: 'forms' },
636 '/',
637 { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
638 { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
639 { name: 'links' },
640 { name: 'insert' },
641 '/',
642 { name: 'styles' },
643 { name: 'colors' },
644 { name: 'tools' },
645 { name: 'others' },
646 { name: 'about' }
647 ] );
648 }
649 } )();
650
651 /**
652 * Separator UI element.
653 *
654 * @readonly
655 * @property {String} [='separator']
656 * @member CKEDITOR
657 */
658 CKEDITOR.UI_SEPARATOR = 'separator';
659
660 /**
661 * The part of the user interface where the toolbar will be rendered. For the default
662 * editor implementation, the recommended options are `'top'` and `'bottom'`.
663 *
664 * Please note that this option is only applicable to [classic](#!/guide/dev_framed)
665 * (`iframe`-based) editor. In case of [inline](#!/guide/dev_inline) editor the toolbar
666 * position is set dynamically depending on the position of the editable element on the screen.
667 *
668 * Read more in the [documentation](#!/guide/dev_toolbarlocation)
669 * and see the [SDK sample](http://sdk.ckeditor.com/samples/toolbarlocation.html).
670 *
671 * config.toolbarLocation = 'bottom';
672 *
673 * @cfg
674 * @member CKEDITOR.config
675 */
676 CKEDITOR.config.toolbarLocation = 'top';
677
678 /**
679 * The toolbox (alias toolbar) definition. It is a toolbar name or an array of
680 * toolbars (strips), each one being also an array, containing a list of UI items.
681 *
682 * If set to `null`, the toolbar will be generated automatically using all available buttons
683 * and {@link #toolbarGroups} as a toolbar groups layout.
684 *
685 * In CKEditor 4.5+ you can generate your toolbar customization code by using the [visual
686 * toolbar configurator](http://docs.ckeditor.com/#!/guide/dev_toolbar).
687 *
688 * // Defines a toolbar with only one strip containing the "Source" button, a
689 * // separator, and the "Bold" and "Italic" buttons.
690 * config.toolbar = [
691 * [ 'Source', '-', 'Bold', 'Italic' ]
692 * ];
693 *
694 * // Similar to the example above, defines a "Basic" toolbar with only one strip containing three buttons.
695 * // Note that this setting is composed by "toolbar_" added to the toolbar name, which in this case is called "Basic".
696 * // This second part of the setting name can be anything. You must use this name in the CKEDITOR.config.toolbar setting
697 * // in order to instruct the editor which `toolbar_(name)` setting should be used.
698 * config.toolbar_Basic = [
699 * [ 'Source', '-', 'Bold', 'Italic' ]
700 * ];
701 * // Load toolbar_Name where Name = Basic.
702 * config.toolbar = 'Basic';
703 *
704 * @cfg {Array/String} [toolbar=null]
705 * @member CKEDITOR.config
706 */
707
708 /**
709 * The toolbar groups definition.
710 *
711 * If the toolbar layout is not explicitly defined by the {@link #toolbar} setting, then
712 * this setting is used to group all defined buttons (see {@link CKEDITOR.ui#addButton}).
713 * Buttons are associated with toolbar groups by the `toolbar` property in their definition objects.
714 *
715 * New groups may be dynamically added during the editor and plugin initialization by
716 * {@link CKEDITOR.ui#addToolbarGroup}. This is only possible if the default setting was used.
717 *
718 * // Default setting.
719 * config.toolbarGroups = [
720 * { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
721 * { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
722 * { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
723 * { name: 'forms' },
724 * '/',
725 * { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
726 * { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
727 * { name: 'links' },
728 * { name: 'insert' },
729 * '/',
730 * { name: 'styles' },
731 * { name: 'colors' },
732 * { name: 'tools' },
733 * { name: 'others' },
734 * { name: 'about' }
735 * ];
736 *
737 * @cfg {Array} [toolbarGroups=see example]
738 * @member CKEDITOR.config
739 */
740
741 /**
742 * Whether the toolbar can be collapsed by the user. If disabled, the Collapse Toolbar
743 * button will not be displayed.
744 *
745 * config.toolbarCanCollapse = true;
746 *
747 * @cfg {Boolean} [toolbarCanCollapse=false]
748 * @member CKEDITOR.config
749 */
750
751 /**
752 * Whether the toolbar must start expanded when the editor is loaded.
753 *
754 * Setting this option to `false` will affect the toolbar only when
755 * {@link #toolbarCanCollapse} is set to `true`:
756 *
757 * config.toolbarCanCollapse = true;
758 * config.toolbarStartupExpanded = false;
759 *
760 * @cfg {Boolean} [toolbarStartupExpanded=true]
761 * @member CKEDITOR.config
762 */
763
764 /**
765 * When enabled, causes the *Arrow* keys navigation to cycle within the current
766 * toolbar group. Otherwise the *Arrow* keys will move through all items available in
767 * the toolbar. The *Tab* key will still be used to quickly jump among the
768 * toolbar groups.
769 *
770 * config.toolbarGroupCycling = false;
771 *
772 * @since 3.6
773 * @cfg {Boolean} [toolbarGroupCycling=true]
774 * @member CKEDITOR.config
775 */
776
777 /**
778 * List of toolbar button names that must not be rendered. This will also work
779 * for non-button toolbar items, like the Font drop-down list.
780 *
781 * config.removeButtons = 'Underline,JustifyCenter';
782 *
783 * This configuration option should not be overused. The recommended way is to use the
784 * {@link CKEDITOR.config#removePlugins} setting to remove features from the editor
785 * or even better, [create a custom editor build](http://ckeditor.com/builder) with
786 * just the features that you will use.
787 * In some cases though, a single plugin may define a set of toolbar buttons and
788 * `removeButtons` may be useful when just a few of them are to be removed.
789 *
790 * @cfg {String} [removeButtons]
791 * @member CKEDITOR.config
792 */
793
794 /**
795 * The toolbar definition used by the editor. It is created from the
796 * {@link CKEDITOR.config#toolbar} option if it is set or automatically
797 * based on {@link CKEDITOR.config#toolbarGroups}.
798 *
799 * @readonly
800 * @property {Object} toolbar
801 * @member CKEDITOR.editor
802 */