Page 1 of 1
Probably not possible but .... Textarea multiple font colors
Posted: Wed Feb 09, 2005 2:32 am
by Chris Corbyn
Hi,
Would anybody know if it's possible to highlight words within a textarea on a web page? Not sure you can specify font colors for just certain words... just the whole font in the textarea I belive?
Thanks
Posted: Wed Feb 09, 2005 2:40 am
by n00b Saibot
what you are saying is possible with richtextedit control on windows side.
if you are developing for Win side maybe you can use that.
AFAIK. there isn't any way for selective formatting inside textarea.

Posted: Wed Feb 09, 2005 2:45 am
by feyd
there are cross browser/platform rich-text editors though that integrate into pages quite well.. hoteditor.com I believe has one..
Posted: Wed Feb 09, 2005 2:56 am
by n00b Saibot
That looks promising...
does that help you
d11wtq 
Posted: Wed Feb 09, 2005 3:12 am
by Chris Corbyn
That's brilliant thanks.... I'll take a look (gonna work on a PHP editting app for integration with a simple filemanager... string highlihgting, function highlighting and the likes).... I'll see how it goes, it may all fall through once I start it.
Posted: Wed Feb 09, 2005 5:10 am
by CoderGoblin
HTMLArea is another rich text editor you can use as a replacement for a text area.
http://www.kevinroth.com/rte/demo.htm is another
Posted: Wed Feb 09, 2005 6:12 am
by JayBird
I have just integrated this one into a CMS i am developing....it is very good with a small file size.
Thanks for the heads up
Mark
Posted: Wed Feb 09, 2005 7:16 am
by Chris Corbyn
Thanks for that.... the hoteditor one that feyd posted has the JS protected and it all need unescaping to read it... this is nicer cheers. It's not your coding is it?
I might change it to remove the buttons etc and just automate syntax highlighting like Dreamweaver or the brilliant freeware
Crimson Editor would do.
Good stuff

Posted: Wed Feb 09, 2005 8:26 am
by CoderGoblin
d11wtq wrote:It's not your coding is it?
I might change it to remove the buttons etc and just automate syntax highlighting like Dreamweaver or the brilliant freeware
Crimson Editor would do.
If you are talking about the kevinroth demo it is not my code (although it initially took me a long time to find it

) The reduction of the options is fairly easy to do within the javascript, with the additional advantage is that you can remove redundant code and therfore shrink the filesize accordingly.
Posted: Wed Feb 09, 2005 8:28 am
by Chris Corbyn
Yeah I just took out all the chunk of code with the buttons in.... I don't want any options for the user to change font colors themselves etc.... i want the colors to just change if the string matches a function from an array of functions and so on and so forth.... I'm at work at the moment but I'll have a good play with it later.
Posted: Wed Feb 09, 2005 8:35 am
by JayBird
Ive just been studying the JS of the Kevin Roth code and it looks pretty simple to remove any or all the user available formatting buttons.
Posted: Wed Feb 09, 2005 9:18 am
by Chris Corbyn
Yeah thanks I had done it already... I just need to see what the other functions do so I can remove the stuff I don't need... all I need are the one's to set font colors and create bold text... haven't even looked how it's done yet, I need time to sit and look at it properly.
The basic idea is to have several plain text files, one for functions, one for PHP syntax and anything else I need. Then These are used to build some arrays... onKeyup or whever the text box is checked for any words that match the value of a function or whatever and if so, the string is colored automatically. Sounds simple but I'm sure i'll trip up. I'll also need to validate whether or not a string has been unquoted etc and brackets are closed or open. The last thing I'll be doing is automatically creating tabs for nested blocks of code... I'll put the code up in snippets when it's done
Posted: Wed Feb 09, 2005 9:48 am
by CoderGoblin
WARNING: Be aware that the colour tags (HTML tags) are hidden from the user and may potentially be deleted accidently in kevinroth's code.
Thought I'd highlight this now as I have run into problems with it before.