Ticket #7280: 7280_4.patch

File 7280_4.patch, 3.9 KB (added by Alfonso Martínez de Lizarrondo, 13 years ago)

Updated patch to trunk

  • _source/plugins/panelbutton/plugin.js

     
    3232
    3333                        $ : function( definition )
    3434                        {
     35                                // Store/Restore a copy of the panel definition to allow switch toolbars
     36                                if ( definition.panel )
     37                                        definition.storedPanel = definition.panel;
     38                                else
     39                                        definition.panel = definition.storedPanel;
     40
    3541                                // We don't want the panel definition in this object.
    3642                                var panelDefinition = definition.panel;
    3743                                delete definition.panel;
  • _source/plugins/richcombo/plugin.js

     
    128128                                clickFn : clickFn
    129129                        };
    130130
    131                         function updateState()
     131                        instance.updateState = function()
    132132                        {
    133133                                var state = this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
    134134                                this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state );
    135135                                this.setValue( '' );
    136136                        }
    137137
    138                         editor.on( 'mode', updateState, this );
     138                        editor.on( 'mode', instance.updateState, this );
    139139                        // If this combo is sensitive to readOnly state, update it accordingly.
    140                         !this.readOnly && editor.on( 'readOnly', updateState, this);
     140                        !this.readOnly && editor.on( 'readOnly', instance.updateState, this);
    141141
    142142                        var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element )
    143143                                {
  • _source/plugins/toolbar/plugin.js

     
    168168                                {
    169169                                        if ( event.data.space == editor.config.toolbarLocation )
    170170                                        {
     171                                                event.data.html += generateToolbarHtml( editor );
     172                                        }
     173                                });
     174
     175                        var generateToolbarHtml = function ( editor )
     176                        {
    171177                                                editor.toolbox = new toolbox();
    172178
    173179                                                var labelId = CKEDITOR.tools.getNextId();
     
    376382                                                                                '</a>' );
    377383                                                }
    378384
    379                                                 event.data.html += output.join( '' );
    380                                         }
    381                                 });
     385                                return output.join( '' );
     386                        };
    382387
    383                         editor.on( 'destroy', function()
     388                        var destroyToolbar = function()
    384389                        {
    385390                                var toolbars, index = 0, i,
    386391                                                items, instance;
     
    393398                                                instance = items[ i ];
    394399                                                if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn );
    395400                                                if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn );
     401
     402                                                if ( instance.button && instance.button.command )
     403                                                {
     404                                                        var command = editor.getCommand( instance.button.command );
     405                                                        command.uiItems = [];
     406                                                }
     407
     408                                                if ( instance.updateState )
     409                                                {
     410                                                        this.removeListener( 'mode', instance.updateState );
     411                                                        this.removeListener( 'readOnly', instance.updateState );
     412                                                }
    396413                                        }
    397414                                }
    398                         });
     415                        };
    399416
     417                        editor.on( 'destroy', destroyToolbar );
     418
     419                        // Method to switch the currently used toolbar
     420                        editor.setToolbar = function( toolbar )
     421                        {
     422                                // Remove existing toolbar
     423                                destroyToolbar.call( this );
     424
     425                                // Set new one
     426                                this.config.toolbar = toolbar;
     427
     428                                // Create it
     429                                var toolbarLocation = this.config.toolbarLocation,
     430                                        space = document.getElementById( 'cke_' + toolbarLocation + '_' + this.name );
     431
     432                                space.innerHTML = generateToolbarHtml( this );
     433
     434                                // IE...
     435                                if ( CKEDITOR.env.ie )
     436                                {
     437                                        var table = space.parentNode.parentNode.parentNode;
     438                                        table.style.display = 'none';
     439                                        // Force refresh
     440                                        var h = table.scrollHeight;
     441                                        table.style.display = '';
     442                                }
     443                        };
     444
    400445                        editor.addCommand( 'toolbarFocus', commands.toolbarFocus );
    401446
    402447                        editor.ui.add( '-', CKEDITOR.UI_SEPARATOR, {} );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy