Changeset 1079
- Timestamp:
- 10/11/08 14:06:27 (2 months ago)
- Files:
-
- 1 modified
-
trunk/XinhaCore.js (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r1077 r1079 2114 2114 return false; 2115 2115 } 2116 else if ( typeof ColorPicker!= 'undefined' && !this.plugins['colorPicker']) editor.registerPlugin('ColorPicker');2116 else if ( typeof Xinha.getPluginConstructor('ColorPicker') != 'undefined' && !this.plugins['colorPicker']) editor.registerPlugin('ColorPicker'); 2117 2117 2118 2118 var toolbar = editor.config.toolbar; … … 2132 2132 return false; 2133 2133 } 2134 else if ( typeof InsertImage!= 'undefined' && !this.plugins['InsertImage']) editor.registerPlugin('InsertImage');2134 else if ( typeof Xinha.getPluginConstructor('InsertImage') != 'undefined' && !this.plugins['InsertImage']) editor.registerPlugin('InsertImage'); 2135 2135 break; 2136 2136 case "createlink": 2137 2137 url = _editor_url + 'modules/CreateLink/link.js'; 2138 if ( typeof Linker== 'undefined' && !Xinha.loadPlugins([{plugin:"CreateLink",url:url}], function() { editor.generate(); } ))2138 if ( typeof Xinha.getPluginConstructor('Linker') == 'undefined' && !Xinha.loadPlugins([{plugin:"CreateLink",url:url}], function() { editor.generate(); } )) 2139 2139 { 2140 2140 return false; 2141 2141 } 2142 else if ( typeof CreateLink!= 'undefined' && !this.plugins['CreateLink']) editor.registerPlugin('CreateLink');2142 else if ( typeof Xinha.getPluginConstructor('CreateLink') != 'undefined' && !this.plugins['CreateLink']) editor.registerPlugin('CreateLink'); 2143 2143 break; 2144 2144 case "inserttable": … … 2148 2148 return false; 2149 2149 } 2150 else if ( typeof InsertTable!= 'undefined' && !this.plugins['InsertTable']) editor.registerPlugin('InsertTable');2150 else if ( typeof Xinha.getPluginConstructor('InsertTable') != 'undefined' && !this.plugins['InsertTable']) editor.registerPlugin('InsertTable'); 2151 2151 break; 2152 2152 } … … 3235 3235 * Category: PLUGINS 3236 3236 ***************************************************/ 3237 3237 /** Plugins may either reside in the golbal scope (not recommended) or in Xinha.plugins. 3238 * This function looks in both locations and is used to check the loading status and finally retrieve the plugin's constructor 3239 * @private 3240 * @type {Function|undefined} 3241 * @param {String} pluginName 3242 */ 3243 Xinha.getPluginConstructor = function(pluginName) 3244 { 3245 return Xinha.plugins[pluginName] || window[pluginName]; 3246 } 3238 3247 3239 3248 /** Create the specified plugin and register it with this Xinha … … 3248 3257 3249 3258 // We can only register plugins that have been succesfully loaded 3250 if ( plugin === null || typeof plugin == 'undefined' || (typeof plugin == 'string' && typeof window[plugin]== 'undefined') )3259 if ( plugin === null || typeof plugin == 'undefined' || (typeof plugin == 'string' && Xinha.getPluginConstructor(plugin) == 'undefined') ) 3251 3260 { 3252 3261 return false; … … 3267 3276 Xinha.prototype.registerPlugin2 = function(plugin, args) 3268 3277 { 3269 if ( typeof plugin == "string" && typeof window[plugin] == 'function' ) 3270 { 3271 plugin = window[plugin]; 3278 if ( typeof plugin == "string" && typeof Xinha.getPluginConstructor(plugin) == 'function' ) 3279 { 3280 var pluginName = plugin; 3281 plugin = Xinha.getPluginConstructor(plugin); 3272 3282 } 3273 3283 if ( typeof plugin == "undefined" ) … … 3276 3286 return false; 3277 3287 } 3278 3288 if (!plugin._pluginInfo) plugin._pluginInfo = {name:pluginName}; 3279 3289 var obj = new plugin(this, args); 3280 3290 if ( obj ) … … 3314 3324 if (forceUnsupported || 3315 3325 // If the plugin is fully loaded, it's supported status is already set. 3316 ( window[plugin] && (typeof window[plugin].supported != 'undefined') && !window[plugin].supported))3326 (Xinha.getPluginConstructor(plugin) && (typeof Xinha.getPluginConstructor(plugin).supported != 'undefined') && !Xinha.getPluginConstructor(plugin).supported)) 3317 3327 { 3318 3328 return _editor_url + "unsupported_plugins/" + plugin ; … … 3333 3343 3334 3344 // Might already be loaded 3335 if ( typeof window[pluginName]!= 'undefined' )3345 if ( typeof Xinha.getPluginConstructor(pluginName) != 'undefined' ) 3336 3346 { 3337 3347 if ( callback ) … … 3404 3414 function statusCallback(pluginName) 3405 3415 { 3406 window[pluginName].supported = stage.indexOf('unsupported') != 0;3416 Xinha.getPluginConstructor(pluginName).supported = stage.indexOf('unsupported') != 0; 3407 3417 callback(pluginName); 3408 3418 } … … 3431 3441 */ 3432 3442 Xinha._pluginLoadStatus = {}; 3433 3443 /** Stores the paths to plugins that are not in the default location 3444 * @private 3445 * @type {Object} 3446 */ 3434 3447 Xinha.externalPlugins = {}; 3448 /** The namespace for plugins 3449 * @private 3450 * @type {Object} 3451 */ 3452 Xinha.plugins = {}; 3435 3453 3436 3454 /** Static function that loads the plugins (see xinha_plugins in NewbieGuide) … … 3472 3490 Xinha.setLoadingMessage (Xinha._lc("Finishing")); 3473 3491 3474 if ( typeof window[plugin]!= 'undefined' )3492 if ( typeof Xinha.getPluginConstructor(plugin) != 'undefined' ) 3475 3493 { 3476 3494 Xinha._pluginLoadStatus[plugin] = 'ready';
