<pvsundarram@gmail.comwrote in message
news:1178103764.159980.146470@n76g2000hsh.googlegr oups.com...
Quote:
hey,
On May 2, 10:32 am, "rf" <r...@invalid.comwrote:
Quote:
>>
>e.preventDefault();
>>
it doesnt work....the eventhandler is getting called after the
character is getting rendered.....
Hmmm.
Where did you preventDefault();?
I am currently writing a an RT editor and it works for me.
Ok. Timeout. <copy/paste>
Did you notice that a single enter produces two "enter"s (that is <br>'s)
in the iframe?
I removed the alert(onkeydown) and added, in its place, e.preventDefault();
That changed the rules. No keystrokes at all are passed on to the iframe,
*except* the enter key. It's being passed to the iframe from somewhere else.
This should give you something to work on.
BTW your code is very hard to read/debug. Layout is bad, but that could be
my newsreader. Some comments might help.
You are doing some things that you should not do, for example relying on
document.all to suggest IE and only IE. Check for the feature you are just
about to use, not some random other one.
BTW 2, intercepting the enter key and trying to duplicate what browsers do
(so as to presumably make them all work like IE, which gets it right in this
instance) is not the way to go for a RT editor. You will end up with lots
and lots of convoluted DOM manipulations. I know. I have been there. Look at
fckeditor or tinymce etc for example. Dreadfull code.
Simply let the browser do whatever it wants to do with the enter key and
then sneak in afterwards and clean up the mess. WYMeditor takes this
approach.
--
Richard.