htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
cancel ENTER key and insert <BR> instead


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.

 


gsmith000001
Novice

Jun 21, 2004, 7:15 AM

Post #1 of 18 (3544 views)
Shortcut
cancel ENTER key and insert <BR> instead Can't Post

I'm trying to switch the action for the enter and shift-enter key-combos. I have tried the commented lines in the editor.js code, but they do not allow for a real break, so you can't break lists or anything.

Here's my adaptation which doesn't seem to work (starting at line 426):

//cancel ENTER key and insert <BR> instead
if (ord == 13 && ctrlKey == false && shiftKey == false && editEvent.type == 'keypress') {
editEvent.returnValue = false;
editor_insertHTML(objname, "<br>");
return;
}

It seems that javascript cannot detect the shift+enter combo or something. Does anyone have any solution to the problem of having enter create <br> yet still retaining the ability to create lists etc?

Any help greatly appreciated.

-Greg


aadnoll
Novice

Jun 22, 2004, 5:29 AM

Post #2 of 18 (3510 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

If you remove the /* and the */ in line 1705 and 1715 and change the

this.insertHTML("<br />");
into
this.insertHTML("<br><tr>");

The text editer won't pass the weird pragraph return (<p>Text</p>)
in case you hit Return.

(I found it very innoying)

Okay, it sends a <tr> with te code but I don't know any HTML client that parses it in a strange manner.
So I find it a bugfix.


gsmith000001
Novice

Jun 22, 2004, 7:00 AM

Post #3 of 18 (3505 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Line 1705?

The editor.js file I have here only goes to line 1105, and the last function listed is editor_cMenu. Are you talking about htmlArea v3? or is my texteditor just being a pain? What function are you editing?

Greg


aadnoll
Novice

Jun 22, 2004, 7:14 AM

Post #4 of 18 (3504 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Yes, I'm talking about htmlArea 3

Download the htmlarea.js below (just modified it) (I have removed some buttons because they do not work here)

http://genotix.nl/htmlarea.js

(it also contains a https bugfix)


(This post was edited by aadnoll on Jun 22, 2004, 7:16 AM)


gsmith000001
Novice

Jun 22, 2004, 7:21 AM

Post #5 of 18 (3500 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

I'm using a customized version of htmlArea v2.

The file you attached above only goes up to line 1626, and the this.insertHTML("<br />"); line is 1279, there is no this.insertHTML("<br /><tr>"); line.

The simple answer is weather javascript can catch a shift-enter and just a plain enter differently.


aadnoll
Novice

Jun 22, 2004, 7:24 AM

Post #6 of 18 (3498 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

mail me your htmlarea.js and I'll adapt it for you.

mailto eric (at) genotix (dot) nl


gsmith000001
Novice

Jun 22, 2004, 7:24 AM

Post #7 of 18 (3498 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Changing:

if (ord == 13 && ctrlKey == false && editEvent.type == 'keypress') {
editEvent.returnValue = false;
editor_insertHTML(objname, "<br>");
return;
}

to this:

if (ord == 13 && ctrlKey == false && editEvent.type == 'keypress') {
editEvent.returnValue = false;
editor_insertHTML(objname, "<br><tr>");
return;
}

In my editor.js catches the enter key but if you are creating a list, it does not go to the next item in the list when you hit enter.


aadnoll
Novice

Jun 22, 2004, 7:32 AM

Post #8 of 18 (3495 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Better make that :

if (ord == 13 && ctrlKey == false && editEvent.type == 'keypress') {
editEvent.returnValue = false;
editor_insertHTML(objname, "<br /><return>");
return;
}


(The layout could change otherwise)


gsmith000001
Novice

Jun 22, 2004, 7:35 AM

Post #9 of 18 (3492 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

That doesn't work, same thing, can't get to the next item in a list. Last time I checked <return> wasn't a valid html tag either.


aadnoll
Novice

Jun 22, 2004, 7:40 AM

Post #10 of 18 (3490 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Hmm... try upgrading to v3 Beta.

<return> isn't a real HTML tag, it's a dummy tag to let the HTMLArea script go to the next line.

Any HTML client will ignore it.


gsmith000001
Novice

Jun 22, 2004, 7:42 AM

Post #11 of 18 (3488 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

It's the <br> that breaks the line when it is inserted by the insertHTML, the <return> is not passed to htmlArea at all, is just outputted into the souce of the textarea.


gsmith000001
Novice

Jun 22, 2004, 7:45 AM

Post #12 of 18 (3487 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Upgrading is not an option.

Do you have a link where I can view your editor in action with the enter key only breaking one line and also working with a numbered list?


aadnoll
Novice

Jun 22, 2004, 7:45 AM

Post #13 of 18 (3487 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

You can get the edited version here.

http://genotix.nl/htmlarea.tar.gz


gsmith000001
Novice

Jun 22, 2004, 7:47 AM

Post #14 of 18 (3485 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

No I mean a page I can view in IE and see the functionality without having to dump your version on my webserver and create a page to test it.

Greg


aadnoll
Novice

Jun 22, 2004, 7:51 AM

Post #15 of 18 (3482 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Try this one :

http://genotix.nl/htmlarea/example.html


gsmith000001
Novice

Jun 22, 2004, 7:53 AM

Post #16 of 18 (3480 views)
Shortcut
Re: [aadnoll] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Thank You.

Now on that example page, how do you get to the next item in a list? If you hit enter, it just moves you down a line and doesn't create 2, 3, 4.. etc. This is the problem I am having. You cannot change the enter to only move one line and retain the ability to create a numbered list.

Greg


aadnoll
Novice

Jun 22, 2004, 7:59 AM

Post #17 of 18 (3479 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

Hmm i see what you mean.

It should add another <li> to the new line before it inserts the <div>.

It shoud add another <li> anyhow as soon as you give a return.


aadnoll
Novice

Jun 22, 2004, 9:33 AM

Post #18 of 18 (3465 views)
Shortcut
Re: [gsmith000001] cancel ENTER key and insert <BR> instead [In reply to] Can't Post

I'm affraid I can't help you with the number and bullet problem.



Can't figure it out myself.


Good luck

I hope they fix the bug soon.

 
 
 


Search for (options)