X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=samples%2Fplugins%2Ftoolbar%2Ftoolbar.html;h=b0f7179a3c04f47f575e09fe11756086e627d7fb;hb=749be886bb4b0ebf70be13397f2279d5446cd0c8;hp=631497594218a7f9766beffe978ee37e7b3709f1;hpb=4625dba05116026713fee9008dd93306be0d1553;p=ckeditor.git diff --git a/samples/plugins/toolbar/toolbar.html b/samples/plugins/toolbar/toolbar.html index 6314975..b0f7179 100644 --- a/samples/plugins/toolbar/toolbar.html +++ b/samples/plugins/toolbar/toolbar.html @@ -1,6 +1,6 @@ @@ -95,6 +95,8 @@ CKEDITOR.replace( 'textarea_id', { (function() { 'use strict'; + var buttonsNames; + CKEDITOR.config.extraPlugins = 'toolbar'; CKEDITOR.on( 'instanceReady', function( evt ) { @@ -112,6 +114,9 @@ CKEDITOR.replace( 'textarea_id', { 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 @@ CKEDITOR.replace( 'textarea_id', { 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 @@ CKEDITOR.replace( 'textarea_id', { 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; } })(); @@ -192,7 +224,7 @@ CKEDITOR.replace( 'textarea_id', { CKEditor - The text editor for the Internet - http://ckeditor.com

- Copyright © 2003-2012, CKSource - Frederico + Copyright © 2003-2013, CKSource - Frederico Knabben. All rights reserved.