Ticket #3758: 3758.patch

File 3758.patch, 1.4 KB (added by Wiktor Walc, 15 years ago)

Patch added by Martin in #3673

  • _source/plugins/dialog/plugin.js

     
    7373                return null;
    7474        }
    7575
     76        function deepCloneArray( list )
     77        {
     78                var retval = [];
     79
     80                for ( var i = 0 ; i < list.length ; i++ )
     81                {
     82                        if ( typeof( list[ i ].pop ) == 'function' )
     83                                retval.push( deepCloneArray( list[ i ] ) );
     84                        else if ( typeof( list[ i ] ) == 'object' )
     85                                retval.push( deepClone( list[ i ] ) );
     86                        else
     87                                retval.push( list[ i ] );
     88                }
     89
     90                return retval;
     91        }
     92
     93        function deepClone( obj )
     94        {
     95                var retval = {};
     96
     97                for ( var i in obj )
     98                {
     99                        var value = obj[ i ];
     100                        if ( typeof( value.pop ) == 'function' )
     101                                retval[ i ] = deepCloneArray( value );
     102                        else if ( typeof( value ) == 'object' )
     103                                retval[ i ] = deepClone( value );
     104                        else
     105                                retval[ i ] = value;
     106                }
     107
     108                return retval;
     109        }
     110
    76111        // Stores dialog related data from skin definitions. e.g. margin sizes.
    77112        var skinData = {};
    78113
     
    96131                }
    97132
    98133                // Completes the definition with the default values.
    99                 definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition );
     134                definition = deepClone( CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition ) );
    100135
    101136                // Create a complex definition object, extending it with the API
    102137                // functions.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy