CodePress
A few months ago I went looking for a javascript based editor that did HTML syntax highlighting.
I found a few things that came close to what I was looking for, but nothing was really good enough to be usable. So, having worked with the “Content Editable” or “Design Mode” HTML stuff before, I decided that I would have a go. I got a fair way through, but I just couldn’t work out how to reset the position of the caret after I had added the required HTML to colour the code.
Codepress performs the rather straight forward function of inserting a control char ( & shy;) where the caret was and puts your cursor back there by removing it again. Clever, wish I’d though of doing that. I’m not sure how it manages to keep the window location consistent yet, must have something to do with the call to window.scroll(0,0) every 50 ms.
Anyway, codepress looks great. The code is small and stable and it works really well. Check it out.
It seems that more and more people are using the WYSIWYG editing capability of browsers, with better and better rich text editors being created. Unfortunately it is still one of the most inconsistent areas of browser DOMs, leading to nasty detection code and masses of browser specific hacks / workarounds. Hopefully this will be addressed in the future with a W3C recommendation and everyone coming to the party (come and play Microsoft!)

