Ticket #3148: 3148.patch
File 3148.patch, 2.8 KB (added by , 15 years ago) |
---|
-
_source/core/resourcemanager.js
102 102 }, 103 103 104 104 /** 105 * Get the f ullpath for a specific loaded resource.105 * Get the folder path for a specific loaded resource. 106 106 * @param {String} name The resource name. 107 107 * @type String 108 108 * @example … … 110 110 */ 111 111 getPath : function( name ) 112 112 { 113 return this.externals[ name ] || this.basePath + name + '/'; 113 var external = this.externals[ name ] 114 return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' ); 114 115 }, 115 116 116 117 /** 117 * Registers a resource to be loaded from an external path instead of the core base path. 118 * Get the file path for a specific loaded resource. 119 * @param {String} name The resource name. 120 * @type String 121 * @example 122 * alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "<editor path>/plugins/sample/plugin.js" 123 */ 124 getFilePath : function( name ) 125 { 126 var external = this.externals[ name ] 127 return CKEDITOR.getUrl( 128 this.getPath( name ) + 129 ( ( external && external.file ) || ( this.fileName + '.js' ) ) ); 130 }, 131 132 /** 133 * Registers one or more resources to be loaded from an external path 134 * instead of the core base path. 118 135 * @param {String} names The resource names, separated by commas. 119 * @param {String} path The resource external path. 136 * @param {String} path The path of the folder containing the resource. 137 * @param {String} [fileName] The resource file name. If not provided, the 138 * default name is used. 120 139 * @example 121 140 * // Loads a plugin from '/myplugin/samples/plugin.js'. 122 141 * CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' ); 142 * @example 143 * // Loads a plugin from '/myplugin/samples/my_plugin.js'. 144 * CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' ); 123 145 */ 124 addExternal : function( names, path )146 addExternal : function( names, path, fileName ) 125 147 { 126 148 names = names.split( ',' ); 127 149 for ( var i = 0 ; i < names.length ; i++ ) 128 150 { 129 151 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.';132 152 133 this.externals[ name ] = path; 153 this.externals[ name ] = 154 { 155 dir : path, 156 file : fileName 157 }; 134 158 } 135 159 }, 136 160 … … 172 196 // If not available yet. 173 197 if ( !loaded[ name ] && !registered[ name ] ) 174 198 { 175 var url = CKEDITOR.getUrl( this.getPath( name ) + this.fileName + '.js');199 var url = this.getFilePath( name ); 176 200 urls.push( url ); 177 201 if ( !( url in urlsNames ) ) 178 202 urlsNames[ url ] = [];