Ticket #4552: 4552_3.patch

File 4552_3.patch, 3.2 KB (added by Garry Yao, 14 years ago)
  • _source/core/tools.js

     
    189189                        return ( !!object && object instanceof Array );
    190190                },
    191191
     192                isEmpty : function ( object )
     193                {
     194                        for ( var i in object )
     195                        {
     196                                if ( object.hasOwnProperty( i ) )
     197                                        return false;
     198                        }
     199                        return true;
     200                },
    192201                /**
    193202                 * Transforms a CSS property name to its relative DOM style name.
    194203                 * @param {String} cssName The CSS property name.
  • _source/plugins/floatpanel/plugin.js

     
    3939                                });
    4040                }
    4141
     42                panel.editor = editor;
    4243                return panel;
    4344        }
    4445
     
    5556
    5657                        this.element = element;
    5758
    58                         // Register panels to editor for easy destroying ( #4241 ).
    59                         editor.panels ? editor.panels.push( element ) : editor.panels = [ element ];
    60 
    61 
    6259                        this._ =
    6360                        {
    6461                                // The panel that will be floating.
     
    329326                        }
    330327                }
    331328        });
     329
     330        CKEDITOR.on( 'instanceDestroyed', function( evt )
     331        {
     332                var editor = evt.data,
     333                        isLastInstance = CKEDITOR.tools.isEmpty( CKEDITOR.instances );
     334
     335                for( var i in panels )
     336                {
     337                        var panel = panels[ i ];
     338                        // Safe to destroy it since there're no more instances.(#4241)
     339                        if( isLastInstance )
     340                        {
     341                                panels[ i ].destroy();
     342                                delete panels[ i ];
     343                        }
     344                        // Panel might be used by other instances, just hide them.(#4552)
     345                        else if ( panel.editor == editor )
     346                                panel.element.hide();
     347                }
     348        } );
    332349})();
  • _source/plugins/panel/plugin.js

     
    230230                block.show();
    231231
    232232                return block;
     233        },
     234
     235        destroy : function()
     236        {
     237                this.element && this.element.remove();
    233238        }
    234239};
    235240
  • _source/themes/default/theme.js

     
    155155
    156156                destroy : function( editor )
    157157                {
    158                         var container = editor.container,
    159                                 panels = editor.panels;
     158                        var container = editor.container;
    160159
    161160                        /*
    162161                         * IE BUG: Removing the editor DOM elements while the selection is inside
     
    183182                        if ( container )
    184183                                container.remove();
    185184
    186                         for( var i = 0 ; panels && i < panels.length ; i++ )
    187                                         panels[ i ].remove();
    188 
    189185                        if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
    190186                        {
    191187                                editor.element.show();
  • _source/core/editor.js

     
    467467                        this.theme.destroy( this );
    468468                        this.fire( 'destroy' );
    469469                        CKEDITOR.remove( this );
     470                        CKEDITOR.fire( 'instanceDestroyed', this );
    470471                },
    471472
    472473                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy