htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Add-Ons:
Restricting keypress chars on editor


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


rahul31
New User

Apr 15, 2004, 11:44 AM

Post #1 of 3 (10582 views)
Shortcut
Restricting keypress chars on editor Can't Post

Hi all,

Is there a way to supress/restrict/trap keypresses on the editor. I found the events cud be trapped from HTMLArea._addEvents or even the _editorEvent function, but the keypress character still appears.

Basically I want only images and backspace to be working on my editor.

Someone pls Help !!

Thnx,

Rahul


hubertus
User

Apr 16, 2004, 3:41 AM

Post #2 of 3 (10571 views)
Shortcut
Re: [rahul31] Restricting keypress chars on editor [In reply to] Can't Post

Hi,

the right place for this question is the normal v3.0 forum.

The answer for your question:

I don't know if it make sense to use this editor only for inserting images and backspaces but if you want to do so:
In function "HTMLArea.prototype._editorEvent" modify like followed:

Code
 HTMLArea.prototype._editorEvent = function(ev) {  
...
if (keyEvent) {
// add next line
HTMLArea._stopEvent(ev);
for (var i in editor.plugins) {
var plugin = editor.plugins.instance;
if (typeof plugin.onKeyPress == "function") plugin.onKeyPress(ev);
}
}
...
};

I didn't test this, but it should work.

Hubertus

----------------------
CMS with HTMLArea (Username: testuser Password: test):
http://www.sundes.de/sundes_wcg/
HTMLArea direct(choose "Textinhalt"):
http://www.sundes.de/cgi-bin/sundes_wcg/egert.pl?layout&kundendir=gastzugang&idlog=RMNaNcMRMcLa2NP

http://www.sundes.de - http://www.hubertus-egert.de

(This post was edited by hubertus on Apr 16, 2004, 3:42 AM)


rahul31
New User

Apr 16, 2004, 5:13 AM

Post #3 of 3 (10563 views)
Shortcut
Re: [hubertus] Restricting keypress chars on editor [In reply to] Can't Post

Hey Hubertus,

Thanx a lot man, this works perfectly!! I just added a line to trap backspace. By the way I'm using two editors on my site. One full fledged HTMLArea (without images) and the second one is this (more of an image manager)

Now everything in kool.....thanx again. Cool

if (keyEvent)
{
if(ev.keyCode!=8) // escape backspace
{
HTMLArea._stopEvent(ev);
for (var i in editor.plugins)
{
var plugin = editor.plugins.instance;
if (typeof plugin.onKeyPress == "function") plugin.onKeyPress(ev);
}
}
}

 
 
 


Search for (options)