Skip to content
Permalink
Browse files

Merge branch 't/10010' into major

  • Loading branch information...
Reinmar committed Feb 19, 2013
2 parents 7754ef7 + a54fd1f commit df9e850ad526edae007ca1b195cc863638b4c8b4
Showing with 34 additions and 2 deletions.
  1. +34 −2 plugins/toolbar/samples/toolbar.html
@@ -95,6 +95,8 @@ <h2 class="samples">Full toolbar configuration</h2>
(function() {
'use strict';
var buttonsNames;
CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.on( 'instanceReady', function( evt ) {
@@ -112,6 +114,9 @@ <h2 class="samples">Full toolbar configuration</h2>
return;
}
if ( !buttonsNames )
buttonsNames = createButtonsNamesHash( editor.ui.items );
// Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.
if ( !editor.config.toolbar ) {
output +=
@@ -132,7 +137,6 @@ <h2 class="samples">Full toolbar configuration</h2>
CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );
} );
CKEDITOR.replace( 'editorCurrent', { height: 100 } );
CKEDITOR.replace( 'editorFull', {
// Reset toolbar settings, so full toolbar will be generated automatically.
@@ -180,7 +184,35 @@ <h2 class="samples">Full toolbar configuration</h2>
function dumpToolbarItems( items ) {
if ( typeof items == 'string' )
return '\'' + items + '\'';
return '[ \'' + items.join( '\', \'' ) + '\' ]';
var names = [],
i, item;
for ( var i = 0; i < items.length; ++i ) {
item = items[ i ];
if ( typeof item == 'string' )
names.push( item );
else {
if ( item.type == CKEDITOR.UI_SEPARATOR )
names.push( '-' );
else
names.push( buttonsNames[ item.name ] );
}
}
return '[ \'' + names.join( '\', \'' ) + '\' ]';
}
// Creates { 'lowercased': 'LowerCased' } buttons names hash.
function createButtonsNamesHash( items ) {
var hash = {},
name;
for ( name in items ) {
hash[ items[ name ].name ] = name;
}
return hash;
}
})();

0 comments on commit df9e850

Please sign in to comment.
You can’t perform that action at this time.