Opened 5 years ago

#1602 new defect

Setting editor.config.Events after makeEditors has no effect

Reported by: ejucovy Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc:

Description

The example configuration script in source:trunk/examples/XinhaConfig.js describes that you can adjust an editor's configuration values between calls to makeEditors() and startEditors():

	  xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
	
	  /** STEP 5 ***************************************************************
	   * If you want to change the configuration variables of any of the
	   * editors,  this is the place to do that, for example you might want to
	   * change the width and height of one of the editors, like this...
	   *
	   *   xinha_editors.myTextArea.config.width  = '640px';
	   *   xinha_editors.myTextArea.config.height = '480px';
	   *
	   ************************************************************************/
	
	
	  /** STEP 6 ***************************************************************
	   * Finally we "start" the editors, this turns the textareas into
	   * Xinha editors.
	   ************************************************************************/
	
	  Xinha.startEditors(xinha_editors);

This mostly works; however, I've noticed that if you try to set the config.Events object at this stage, like so, it has no effect:

xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
xinha_editors.myTextArea.config.Events = {'onBeforeSubmit': function() { alert("foo"); };
Xinha.startEditors(xinha_editors);

On the other hand, updating sub-objects of the existing config.Events object does work properly:

xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
xinha_editors.myTextArea.config.Events.onBeforeSubmit = function() { alert("foo"); };
Xinha.startEditors(xinha_editors);

This should probably be documented; and possibly fixed, or an explanatory error/warning triggered.

Change History (0)

Note: See TracTickets for help on using tickets.