<!DOCTYPE html>\r
<!--\r
-Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.md or http://ckeditor.com/license\r
-->\r
<html>\r
<head>\r
<meta name="ckeditor-sample-name" content="Toolbar Configurations">\r
<meta name="ckeditor-sample-group" content="Advanced Samples">\r
<meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout.">\r
- <meta name="ckeditor-sample-isnew" content="1">\r
<script src="../../../ckeditor.js"></script>\r
<link href="../../../samples/sample.css" rel="stylesheet">\r
</head>\r
(function() {\r
'use strict';\r
\r
+ var buttonsNames;\r
+\r
CKEDITOR.config.extraPlugins = 'toolbar';\r
\r
CKEDITOR.on( 'instanceReady', function( evt ) {\r
var editor = evt.editor,\r
editorCurrent = editor.name == 'editorCurrent',\r
- defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups ),\r
+ defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),\r
pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),\r
output = '';\r
\r
return;\r
}\r
\r
+ if ( !buttonsNames )\r
+ buttonsNames = createButtonsNamesHash( editor.ui.items );\r
+\r
// Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.\r
if ( !editor.config.toolbar ) {\r
output +=\r
CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );\r
} );\r
\r
-\r
CKEDITOR.replace( 'editorCurrent', { height: 100 } );\r
CKEDITOR.replace( 'editorFull', {\r
// Reset toolbar settings, so full toolbar will be generated automatically.\r
toolbar: null,\r
toolbarGroups: null,\r
+ removeButtons: null,\r
height: 100\r
} );\r
\r
function dumpToolbarItems( items ) {\r
if ( typeof items == 'string' )\r
return '\'' + items + '\'';\r
- return '[ \'' + items.join( '\', \'' ) + '\' ]';\r
+\r
+ var names = [],\r
+ i, item;\r
+\r
+ for ( var i = 0; i < items.length; ++i ) {\r
+ item = items[ i ];\r
+ if ( typeof item == 'string' )\r
+ names.push( item );\r
+ else {\r
+ if ( item.type == CKEDITOR.UI_SEPARATOR )\r
+ names.push( '-' );\r
+ else\r
+ names.push( buttonsNames[ item.name ] );\r
+ }\r
+ }\r
+\r
+ return '[ \'' + names.join( '\', \'' ) + '\' ]';\r
+ }\r
+\r
+ // Creates { 'lowercased': 'LowerCased' } buttons names hash.\r
+ function createButtonsNamesHash( items ) {\r
+ var hash = {},\r
+ name;\r
+\r
+ for ( name in items ) {\r
+ hash[ items[ name ].name ] = name;\r
+ }\r
+\r
+ return hash;\r
}\r
\r
})();\r
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
</p>\r
<p id="copy">\r
- Copyright © 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
+ Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
Knabben. All rights reserved.\r
</p>\r
</div>\r