Kris Wallsmith

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromKris Wallsmith
ToMe
SubjectTextArea and iFrame code editor - help
Date17 May 2005 00:44
Hi,

Your site is very helpful. Thank you.

I am coding a simple web based code editor using Javascript. Similar to
Dreamweaver, it has a Code and a Preview mode, although the Preview mode is
not editable, which is fine. I simply dump the TextArea into an iFrame using
document.write() when the user switches to Preview.

The one element I would like to add is syntax highlighting for HTML in the
Code view. I have not been able to find a way to do this within a TextArea,
so it looks like I am going to have to use the JavaScript/hidden
input/iFrame process used by most TTW WYSIWYG editors I've come across for
the Code view.

Do you know of a tutorial that covers the basic concept of this process? Do
you have a straight-forward explanation? I'd really appreciate any help or
links you have.

I need help filling the gap between the user's keyboard and the iFrame ...

Thanks,
Kris Wallsmith
FromMe
ToKris Wallsmith
SubjectRe: TextArea and iFrame code editor - help
Date17 May 2005 19:45
Kris,

The most easy to understand is the one that used to be on Netscape DevEdge.
It is temporarily held on
http://devedge-temp.mozilla.org/viewsource/2003/midas/01/index_en.html
I suggest you grab a copy in case the docs are forced to go offline again.

Note that Safari 1.3+ also supports it now. I am hoping that maybe Opera
will follow soon.

As for how to do what you want (syntax highlighting), I don't actually know
how to do that, since I have not yet done any work on rich text editing. At
a guess, you will have to wait for changes, and after each one, re-read the
innerText of the iframe body, and re-do the highlighting. This could become
processor intensive ....

Anyway, hope this is useful.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.