Changeset 51


Ignore:
Timestamp:
03/23/05 10:22:16 (15 years ago)
Author:
guillaumed
Message:

change registerPlugin to return the plugin created and add refreshPlugin to allow registering of plugin dynamicaly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/htmlarea.js

    r42 r51  
    14841484    for (var i in editor.plugins) { 
    14851485      var plugin = editor.plugins[i].instance; 
    1486       if (typeof plugin.onGenerate == "function") 
    1487         plugin.onGenerate(); 
    1488       if (typeof plugin.onGenerateOnce == "function") { 
    1489         plugin.onGenerateOnce(); 
    1490         plugin.onGenerateOnce = null; 
    1491       } 
     1486      HTMLArea.refreshPlugin(plugin); 
    14921487    } 
    14931488 
     
    15971592 
    15981593// Create the specified plugin and register it with this HTMLArea 
     1594// return the plugin created to allow refresh when necessary 
    15991595HTMLArea.prototype.registerPlugin = function() { 
    16001596  var plugin = arguments[0]; 
     
    16021598  for (var i = 1; i < arguments.length; ++i) 
    16031599    args.push(arguments[i]); 
    1604   this.registerPlugin2(plugin, args); 
     1600  return this.registerPlugin2(plugin, args); 
    16051601}; 
    16061602 
     
    16251621    clone.args = args; 
    16261622    this.plugins[plugin._pluginInfo.name] = clone; 
     1623    return obj; 
    16271624  } else 
    16281625    alert("Can't register plugin " + plugin.toString() + "."); 
     
    17041701} 
    17051702 
     1703// refresh plugin by calling onGenerate or onGenerateOnce method. 
     1704HTMLArea.refreshPlugin = function(plugin) { 
     1705  if (typeof plugin.onGenerate == "function") 
     1706    plugin.onGenerate(); 
     1707  if (typeof plugin.onGenerateOnce == "function") { 
     1708    plugin.onGenerateOnce(); 
     1709    plugin.onGenerateOnce = null; 
     1710  } 
     1711}; 
    17061712 
    17071713HTMLArea.loadStyle = function(style, plugin) { 
Note: See TracChangeset for help on using the changeset viewer.