views:

221

answers:

3

I am hoping to build an IDE in javascript that behaves much like gmail except the style will change automatically based on what they type as they type. The logic for this isnt where im struggling. Its how gmail achieves the ability to edit in a rich edit format in html. As far as I know the textarea control does not work this way, so how do they fake this functionality?

A: 

Download one of the many open source system that allow that, and see how they did it.
Basically, they are attaching event handlers to button which in turn know how to insert "stuff" in the place the cursor is currently located in the text area, OR around the selected area in the textarea.

Itay Moav
The "stuff" was the purpose of the question.
Dested
stuff==html tags
Itay Moav
+1  A: 

I'm not quite sure whether this is what you mean, but are you looking for a online WYSIWYG editor?

In that case allow me to recommend CKEDitor, it is quite fast, modern and robust.

You can find a broader list in the corresponding Wikipedia entry.

You would probably have to customize any of the editors to be able to edit E-Mails (You wouldn't be able to work with any pre-defined CSS classes for example, so the editor would have to do all the style definitions directly in the tag) but it shouldn't be a problem.

Pekka
+2  A: 

Google for "content editable" Try to press F7 in Firefox end edit HTML page directly :) Gmail uses Frame inside a page with contenteditable="true".

See also Google Web Toolkit: http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideWidgetGallery There is RichTextArea widget.

Malx