Formatted textareas

How do you format individual portions of text in a textarea? IE, like Gmail or this thingy does.

It’s called a WYSIWYG (What You See Is What You Get) editor.

http://www.google.com/search?q="WYSIWYG%20Editor"
That search should give you a ton of results.

But how is it actually done? What HTML/CSS combo actually allows you to change the formatting in the box?

If I had

<textarea>a b c d e f g</textarea>

and I wanted to make “c” bold, how could I do it? Just assumed it’s static for now, don’t worry about JS (for now :)). I just need the static HTML.

This site uses DHTMLEditor, which you can view the source to through OpenFirst (http://www.openfirst.org or http://openfirst.sourceforge.net).

See also:

http://www.chiefdelphi.com/forums/showthread.php?p=394010#post394010

(and the PM that I sent you this morning with much of the same information). It’s kind of weird to be answering questions via PM before they’re asked, lol.

Yep. I was hoping for a simple “oh, you just stick this attribute in” type thing, so I wouldn’t have to dig through all that stuff. :slight_smile:

I did find out how it’s done (Mozilla has a nice page), and started some work (well, you can type stuff) at http://traherom.homeunix.net/editor/js.html. It’s kinda plain because I was just using it as testing… :slight_smile:

I’m thinking about doing something along the lines of this (click to edit part of the page. Or maybe I could do it as select the text you want to edit then press a key), but add rich editing instead of just the plain textarea.

That would be nice (just having to set a single attribute); actually, though, the one I suggested in the edit I made to the thread mentioned above will go through every textarea (or other element that you choose) and convert it to be fancy automatically. It also doesn’t require mucking around with setting Javascript things up on each of the forms you want to use for onclick, etc. I’m actually surprised that it’s so transparent. (If you download it and look at the simple demo, which has a lot less HTML, etc. confusing things, it becomes obvious how things work, and easy to move up to the advanced one).