Changeset 1107


Ignore:
Timestamp:
11/07/08 21:02:34 (11 years ago)
Author:
ray
Message:

#1319 make event hooks like onKeyPress accesible from the config object

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r1106 r1107  
    421421  this._toolbarObjects = {}; 
    422422   
     423  //hook in config.Events as as a "plugin" 
     424  this.plugins['Events'] =  
     425  { 
     426    name: 'Events', 
     427    developer : 'The Xinha Core Developer Team', 
     428    instance: config.Events 
     429  }; 
    423430} 
    424431 
     
    985992    'closeOnEscape':true 
    986993  }; 
    987  
     994  /** You can add functions to this object to be executed on specific events 
     995   * Example: 
     996   * <pre> 
     997   * xinha_config.Events.onKeyPress = function (event) 
     998   * { 
     999   *    //do something  
     1000   *    return false; 
     1001   * } 
     1002   * </pre> 
     1003   * Note that <em>this</em> inside the function refers to the respective Xinha object 
     1004   * The possible function names are documented at <a href="http://trac.xinha.org/wiki/Documentation/EventHooks">http://trac.xinha.org/wiki/Documentation/EventHooks</a> 
     1005   */ 
     1006  this.Events = {}; 
     1007   
    9881008  /** ?? 
    9891009   * Default: <code>{}</code> 
     
    23772397  if (Xinha.is_opera) 
    23782398    {        
    2379       editor.initIframe();       
     2399      editor.initIframe(); 
    23802400    } 
    23812401  else 
     
    36003620  { 
    36013621    var plugin = this.plugins[i].instance; 
    3602      
     3622 
    36033623    // Skip the browser specific plugin 
    36043624    if ( plugin == this._browserSpecificPlugin) continue; 
     
    36063626    if ( plugin && typeof plugin[methodName] == "function" ) 
    36073627    { 
    3608       if ( plugin[methodName].apply(plugin, argsArray) ) 
     3628      var thisArg = (i == 'Events') ? this : plugin; 
     3629      if ( plugin[methodName].apply(thisArg, argsArray) ) 
    36093630      { 
    36103631        return true; 
     
    36223643    } 
    36233644  } 
    3624      
    36253645  return false; 
    36263646} 
Note: See TracChangeset for help on using the changeset viewer.