As I said earlier, why don't you download the FCKeditor and see how it works? The best way to learn these kind of things is to learn from existing applications.
AFAIK, there are no full-blown tutorials that explain how to build an editor from scratch. The people that know how to do it built one, and the people that don't know how to do it use the editors built by those who do ;)
Get a copy of the FCKeditor and tear it apart. Use a JavaScript debugger and find out what code fires when, what calls what, how things have been modularized and so on. There is an amazing amount of technology in that editor (and others too, BTW), so you could learn a lot from it.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.