﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
7280	Ability to switch toolbar at runtime	Alfonso Martínez de Lizarrondo	Alfonso Martínez de Lizarrondo	"These is a feature that people have requested several times, these are two related tickets (although they don't request the same thing) #6374 and #7038

This is a request to provide a editor.setToolbar() method that can change the current toolbar to a new one on the fly, it's almost possible with this code:

{{{
// Set new Toolbar
CKEDITOR.editor.prototype.setToolbar = function( toolbar )
{
	// Destroy previous toolbar
	var toolbars, index = 0, i,
			items, instance;
	toolbars = this.toolbox.toolbars;
	for ( ; index < toolbars.length; index++ )
	{
		items = toolbars[ index ].items;
		for ( i = 0; i < items.length; i++ )
		{
			instance = items[ i ];
			if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn );
			if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn );

			if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null;
		}
	}

	// Set new one
	this.config.toolbar = toolbar;

	// create it
	var toolbarLocation = this.config.toolbarLocation,
		space = document.getElementById('cke_' + toolbarLocation + '_' + this.name),
		html = this.fire( 'themeSpace', { space : toolbarLocation, html : '' } ).html;

	space.innerHTML = html;
}

}}}

But there are two issues that have to be patched in order to work this way.

The patch addresses just those issues, but a more robust and compact setToolbar method could be created.
"	New Feature	review	Normal		UI : Toolbar				satya_minnekanti@… paul@… me@…
