Announcement

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

#1 2008-03-10 10:54:11

peterbe
New member
Registered: 2008-03-10
Posts: 2

Trouble with OnKeyPress

First off, I didn't build this Intranet site and I'm new to Xinha. I'm trying to get an onkeypress event to be registered for an otherwise working fine htmlarea.
I don't think I want to use the magical plugins/* stuff. I want to deliberately add the plugin. Here's what I've done:

1. I've written a file called check-on-key-press.js that is loaded before htmlarea.js is loaded. (code below)

2. After htmlarea.js is loaded, I load my_htmlarea.js that contains the following:

xinha_init = function() {
available_plugins = [ 'ContextMenu', 'TableOperations', 'FullScreen', 'CheckOnKeyPress' ];
if(!HTMLArea.loadPlugins(available_plugins, xinha_init)) return;
...
}

The check-on-key-press.js contains the following code:

function CheckOnKeyPress(editor) {
   this.editor = editor;
}
CheckOnKeyPress._pluginInfo = {
                name          : "CheckOnKeyPress",
                version       : "1.0",
                developer     : "",
                developer_url : "",
                c_owner       : "Niko Sams",
                sponsor       : "",
                sponsor_url   : "",
                license       : "htmlArea"
};
         
CheckOnKeyPress.prototype.onKeyPress = function(ev) {
   console.log('on keypress!');
};

Everything loads and there are no errors but the function isn't fired when I press things in the htmlarea that is otherwise loaded fine.

PS. This is HTMLArea taken from a trunk revision 421

Offline

#2 2008-03-10 11:20:05

peterbe
New member
Registered: 2008-03-10
Posts: 2

Re: Trouble with OnKeyPress

I've cracked it myself. The problem was that I added the name of my plugin to the 'available_plugins' array **only**. I also had to add it to 'global_plugins'. Now it works.
Let's see if it also works in IE. Wish me luck.

Offline

Board footer

Powered by FluxBB