Ticket #2906: 2906.patch

File 2906.patch, 3.0 KB (added by Martin Kou, 15 years ago)
  • _source/core/resourcemanager.js

     
    115115
    116116        /**
    117117         * Registers a resource to be loaded from an external path instead of the core base path.
    118          * @param {String} name The resource name.
     118         * @param {String} names The resource names, separated by commas.
    119119         * @param {String} path The resource external path.
    120120         * @example
    121121         * // Loads a plugin from '/myplugin/samples/plugin.js'.
    122122         * CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
    123123         */
    124         addExternal : function( name, path )
     124        addExternal : function( names, path )
    125125        {
    126                 if ( this.registered[ name ] || this.externals[ name ] )
    127                         throw '[CKEDITOR.resourceManager.import] The resource name "' + name + '" is already registered or imported.';
     126                names = names.split( ',' );
     127                for ( var i = 0 ; i < names.length ; i++ )
     128                {
     129                        var name = names[ i ];
     130                        if ( this.registered[ name ] || this.externals[ name ] )
     131                                throw '[CKEDITOR.resourceManager.import] The resource name "' + name + '" is already registered or imported.';
    128132
    129                 this.externals[ name ] = path;
     133                        this.externals[ name ] = path;
     134                }
    130135        },
    131136
    132137        /**
     
    169174                        {
    170175                                var url = CKEDITOR.getUrl( this.getPath( name ) + this.fileName + '.js' );
    171176                                urls.push( url );
    172                                 urlsNames[ url ] = name;
     177                                if ( !( url in urlsNames ) )
     178                                        urlsNames[ url ] = [];
     179                                urlsNames[ url ].push( name );
    173180                        }
    174181                        else
    175182                                resources[ name ] = this.get( name );
     
    178185                CKEDITOR.scriptLoader.load( urls, function( completed, failed )
    179186                        {
    180187                                if ( failed.length )
    181                                         throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ] + '" was not found at "' + failed[ 0 ] + '".';
     188                                {
     189                                        throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' )
     190                                                + '" was not found at "' + failed[ 0 ] + '".';
     191                                }
    182192
    183193                                for ( var i = 0 ; i < completed.length ; i++ )
    184194                                {
    185                                         var name = urlsNames[ completed[ i ] ];
    186                                         resources[ name ] = this.get( name );
     195                                        var nameList = urlsNames[ completed[ i ] ];
     196                                        for ( var j = 0 ; j < nameList.length ; j++ )
     197                                        {
     198                                                var name = nameList[ j ];
     199                                                resources[ name ] = this.get( name );
    187200
    188                                         loaded[ name ] = 1;
     201                                                loaded[ name ] = 1;
     202                                        }
    189203                                }
    190204
    191205                                callback.call( scope, resources );
  • config.js

     
    88        // Define changes to default configuration here. For example:
    99        // config.autoLanguage = false;
    1010        // config.defaultLanguage = 'pt-br';
     11
     12        CKEDITOR.plugins.addExternal( 'api_dialog,api_dialog2,api_dialog3','file:///C:/external_plugin/');
     13
     14        // Append the "peopletools" plugin to the list of plugins
     15        // to be loaded.
     16        config.plugins += ',api_dialog,api_dialog2';
    1117};
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy