Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-03-20 20:42:16

mr.morphic
New member
Registered: 2006-03-20
Posts: 1

Dynamically loading plugins

Hi. I'm using xinha in an application I'm building. It's a great component, and works better than anything else I've tried, especially with XHTML. So thanks.

The application I'm building asynchronously loads objects to edit, and dynamically builds interfaces in javascript using metadata about the types of objects. So in general, there are multiple xinha editors for an item, and the names of the textareas are not known up front (so can't be coded into the initialisation code given on the newbies page.) Most of these things have been reaonsably straightforward.

The problem I have right now is that I want a javascript method to be called whenever a change is made to the value as the user edits ("modified" appears immediately on the status bar as soon as they edit a value). I have had a look through the forum, and seen a thread about creating a plugin called CheckOnKeyPress, which gives the code for the plug-in but doesn't show how to register that plugin.

The only thing I've seen about registering a plug-in is in the setting of xinha_plugins. This seems to go to a file though, and the plug-in code is inline in JavaScript, not in a file.

So I've got:


--------

function CheckOnKeyyPress(editor)
{ ... }

CheckOnKeyPress._pluginInfo =
{
...
};

CheckOnKeyPress.prototype.onKeyPress = function(ev)
{
...
}
--------


1. How do I register this plugin in the Config object dynamically? 2. Are there events other than KeyPress? that need to be trapped o check for changes (e.g. user selects text with a mouse and clicks Bold - does that generate a KeyPress??)

Any help would be much appreciated.

Offline

Board footer

Powered by FluxBB