Index: _source/plugins/panelbutton/plugin.js
===================================================================
--- _source/plugins/panelbutton/plugin.js (revision 6640)
+++ _source/plugins/panelbutton/plugin.js (working copy)
@@ -46,6 +46,12 @@
$ : function( definition )
{
+ // Store/Restore a copy of the panel definition to allow switch toolbars
+ if ( definition.panel )
+ definition.storedPanel = definition.panel;
+ else
+ definition.panel = definition.storedPanel ;
+
// We don't want the panel definition in this object.
var panelDefinition = definition.panel;
delete definition.panel;
Index: _source/plugins/richcombo/plugin.js
===================================================================
--- _source/plugins/richcombo/plugin.js (revision 6640)
+++ _source/plugins/richcombo/plugin.js (working copy)
@@ -128,13 +128,14 @@
clickFn : clickFn
};
- editor.on( 'mode', function()
+ instance.onmode = function()
{
this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
this.setValue( '' );
- },
- this );
+ };
+ editor.on( 'mode', instance.onmode, this );
+
var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element )
{
ev = new CKEDITOR.dom.event( ev );
Index: _source/plugins/toolbar/plugin.js
===================================================================
--- _source/plugins/toolbar/plugin.js (revision 6640)
+++ _source/plugins/toolbar/plugin.js (working copy)
@@ -153,218 +153,264 @@
};
editor.on( 'themeSpace', function( event )
+ {
+ if ( event.data.space == editor.config.toolbarLocation )
{
- if ( event.data.space == editor.config.toolbarLocation )
- {
- editor.toolbox = new toolbox();
+ event.data.html += generateToolbarHtml( editor );
+ }
+ });
- var labelId = CKEDITOR.tools.getNextId();
+ var generateToolbarHtml = function ( editor )
+ {
+ editor.toolbox = new toolbox();
- var output = [ '
' );
+ groupStarted = 0;
+ }
- output.push( '' );
+ if ( row === '/' )
+ {
+ output.push( '' );
+ continue;
+ }
- // Add the toolbar to the "editor.toolbox.toolbars"
- // array.
- var index = toolbars.push( toolbarObj ) - 1;
+ output.push( '' );
- // Create the next/previous reference.
- if ( index > 0 )
- {
- toolbarObj.previous = toolbars[ index - 1 ];
- toolbarObj.previous.next = toolbarObj;
- }
+ // Add the toolbar to the "editor.toolbox.toolbars"
+ // array.
+ var index = toolbars.push( toolbarObj ) - 1;
- // Create all items defined for this toolbar.
- for ( var i = 0 ; i < row.length ; i++ )
- {
- var item,
- itemName = row[ i ];
+ // Create the next/previous reference.
+ if ( index > 0 )
+ {
+ toolbarObj.previous = toolbars[ index - 1 ];
+ toolbarObj.previous.next = toolbarObj;
+ }
- if ( itemName == '-' )
- item = CKEDITOR.ui.separator;
- else
- item = editor.ui.create( itemName );
+ // Create all items defined for this toolbar.
+ for ( var i = 0 ; i < row.length ; i++ )
+ {
+ var item,
+ itemName = row[ i ];
- if ( item )
+ if ( itemName == '-' )
+ item = CKEDITOR.ui.separator;
+ else
+ item = editor.ui.create( itemName );
+
+ if ( item )
+ {
+ if ( item.canGroup )
+ {
+ if ( !groupStarted )
{
- if ( item.canGroup )
- {
- if ( !groupStarted )
- {
- output.push( '' );
- groupStarted = 1;
- }
- }
- else if ( groupStarted )
- {
- output.push( '' );
- groupStarted = 0;
- }
-
- var itemObj = item.render( editor, output );
- index = toolbarObj.items.push( itemObj ) - 1;
-
- if ( index > 0 )
- {
- itemObj.previous = toolbarObj.items[ index - 1 ];
- itemObj.previous.next = itemObj;
- }
-
- itemObj.toolbar = toolbarObj;
- itemObj.onkey = itemKeystroke;
-
- /*
- * Fix for #3052:
- * Prevent JAWS from focusing the toolbar after document load.
- */
- itemObj.onfocus = function()
- {
- if ( !editor.toolbox.focusCommandExecuted )
- editor.focus();
- };
+ output.push( '' );
+ groupStarted = 1;
}
}
-
- if ( groupStarted )
+ else if ( groupStarted )
{
output.push( '' );
groupStarted = 0;
}
- output.push( '' );
+ var itemObj = item.render( editor, output );
+ index = toolbarObj.items.push( itemObj ) - 1;
+
+ if ( index > 0 )
+ {
+ itemObj.previous = toolbarObj.items[ index - 1 ];
+ itemObj.previous.next = itemObj;
+ }
+
+ itemObj.toolbar = toolbarObj;
+ itemObj.onkey = itemKeystroke;
+
+ /*
+ * Fix for #3052:
+ * Prevent JAWS from focusing the toolbar after document load.
+ */
+ itemObj.onfocus = function()
+ {
+ if ( !editor.toolbox.focusCommandExecuted )
+ editor.focus();
+ };
}
+ }
- output.push( '' );
+ if ( groupStarted )
+ {
+ output.push( '' );
+ groupStarted = 0;
+ }
- if ( editor.config.toolbarCanCollapse )
+ output.push( '' );
+ }
+
+ output.push( '' );
+
+ if ( editor.config.toolbarCanCollapse )
+ {
+ var collapserFn = CKEDITOR.tools.addFunction(
+ function()
{
- var collapserFn = CKEDITOR.tools.addFunction(
- function()
- {
- editor.execCommand( 'toolbarCollapse' );
- });
+ editor.execCommand( 'toolbarCollapse' );
+ });
- editor.on( 'destroy', function () {
- CKEDITOR.tools.removeFunction( collapserFn );
- });
+ editor.on( 'destroy', function () {
+ CKEDITOR.tools.removeFunction( collapserFn );
+ });
- var collapserId = CKEDITOR.tools.getNextId();
+ var collapserId = CKEDITOR.tools.getNextId();
- editor.addCommand( 'toolbarCollapse',
+ editor.addCommand( 'toolbarCollapse',
+ {
+ exec : function( editor )
+ {
+ var collapser = CKEDITOR.document.getById( collapserId ),
+ toolbox = collapser.getPrevious(),
+ contents = editor.getThemeSpace( 'contents' ),
+ toolboxContainer = toolbox.getParent(),
+ contentHeight = parseInt( contents.$.style.height, 10 ),
+ previousHeight = toolboxContainer.$.offsetHeight,
+ collapsed = !toolbox.isVisible();
+
+ if ( !collapsed )
{
- exec : function( editor )
- {
- var collapser = CKEDITOR.document.getById( collapserId ),
- toolbox = collapser.getPrevious(),
- contents = editor.getThemeSpace( 'contents' ),
- toolboxContainer = toolbox.getParent(),
- contentHeight = parseInt( contents.$.style.height, 10 ),
- previousHeight = toolboxContainer.$.offsetHeight,
- collapsed = !toolbox.isVisible();
+ toolbox.hide();
+ collapser.addClass( 'cke_toolbox_collapser_min' );
+ collapser.setAttribute( 'title', editor.lang.toolbarExpand );
+ }
+ else
+ {
+ toolbox.show();
+ collapser.removeClass( 'cke_toolbox_collapser_min' );
+ collapser.setAttribute( 'title', editor.lang.toolbarCollapse );
+ }
- if ( !collapsed )
- {
- toolbox.hide();
- collapser.addClass( 'cke_toolbox_collapser_min' );
- collapser.setAttribute( 'title', editor.lang.toolbarExpand );
- }
- else
- {
- toolbox.show();
- collapser.removeClass( 'cke_toolbox_collapser_min' );
- collapser.setAttribute( 'title', editor.lang.toolbarCollapse );
- }
+ // Update collapser symbol.
+ collapser.getFirst().setText( collapsed ?
+ '\u25B2' : // BLACK UP-POINTING TRIANGLE
+ '\u25C0' ); // BLACK LEFT-POINTING TRIANGLE
- // Update collapser symbol.
- collapser.getFirst().setText( collapsed ?
- '\u25B2' : // BLACK UP-POINTING TRIANGLE
- '\u25C0' ); // BLACK LEFT-POINTING TRIANGLE
+ var dy = toolboxContainer.$.offsetHeight - previousHeight;
+ contents.setStyle( 'height', ( contentHeight - dy ) + 'px' );
- var dy = toolboxContainer.$.offsetHeight - previousHeight;
- contents.setStyle( 'height', ( contentHeight - dy ) + 'px' );
+ editor.fire( 'resize' );
+ },
- editor.fire( 'resize' );
- },
+ modes : { wysiwyg : 1, source : 1 }
+ } );
- modes : { wysiwyg : 1, source : 1 }
- } );
+ output.push( '',
+ '▲', // BLACK UP-POINTING TRIANGLE
+ '' );
+ }
- output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ')">',
- '▲', // BLACK UP-POINTING TRIANGLE
- '' );
- }
+ return output.join( '' );
+ };
- event.data.html += output.join( '' );
- }
- });
+ var destroyToolbar = function()
+ {
+ var index = 0,
+ i,
+ items,
+ instance,
+ toolbars = this.toolbox.toolbars;
- editor.on( 'destroy', function()
- {
- 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;
+
+ if ( instance.button && instance.button.command )
+ {
+ var command = editor.getCommand( instance.button.command );
+ command.uiItems = [];
+ }
+
+ if ( instance.onmode )
+ this.removeListener( 'mode', instance.onmode );
}
}
- });
+ };
+ editor.on( 'destroy', destroyToolbar );
+
+ // Method to switch the currently used toolbar
+ editor.setToolbar = function( toolbar )
+ {
+ // Remove existing toolbar
+ destroyToolbar.call( this );
+
+ // Set new one
+ this.config.toolbar = toolbar;
+
+ // Create it
+ var toolbarLocation = this.config.toolbarLocation,
+ space = document.getElementById('cke_' + toolbarLocation + '_' + this.name);
+
+ space.innerHTML = generateToolbarHtml( this );
+
+ // IE...
+ if ( CKEDITOR.env.ie )
+ {
+ var table = space.parentNode.parentNode.parentNode;
+ table.style.display = 'none';
+ // Force refresh
+ var h = table.scrollHeight;
+ table.style.display = '';
+ }
+ };
+
editor.addCommand( 'toolbarFocus', commands.toolbarFocus );
}
});