X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=samples%2Fplugins%2Ftoolbar%2Ftoolbar.html;h=6cf2ddf138f610d2a342daf6b324db30b398bdee;hb=dc5b273b4cbd7e7d0167499e7649867ba2a5b408;hp=6f0b044e546ddb0a2963f8e068fcc16b0261fbd1;hpb=860af3c4bde9866c53d5123c57e3dc6166e0fe1e;p=ckeditor.git
diff --git a/samples/plugins/toolbar/toolbar.html b/samples/plugins/toolbar/toolbar.html
index 6f0b044..6cf2ddf 100644
--- a/samples/plugins/toolbar/toolbar.html
+++ b/samples/plugins/toolbar/toolbar.html
@@ -1,16 +1,15 @@
- Toolbar Configuration — CKEditor Sample
+ Toolbar Configuration — CKEditor Sample
-
@@ -95,12 +94,14 @@ CKEDITOR.replace( 'textarea_id', {
(function() {
'use strict';
+ var buttonsNames;
+
CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor,
editorCurrent = editor.name == 'editorCurrent',
- defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups ),
+ defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),
pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),
output = '';
@@ -112,6 +113,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,12 +136,12 @@ 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.
toolbar: null,
toolbarGroups: null,
+ removeButtons: null,
height: 100
} );
@@ -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-2013, CKSource - Frederico
+ Copyright © 2003-2014, CKSource - Frederico
Knabben. All rights reserved.