It’s important that you think of the user up front and what you want them to be able to edit. If the audience is developers / technically minded people I would strongly reccomend you look at plain text solutions like this forum uses: http://markitup.jaysalvat.com/home/
If you do want a HTML editor I would then recommend http://www.wymeditor.org/ as I love it’s simplicity and the fact that it doesn’t represent exactly what the html will look like (shows the elements used).
That being said I’ve written my own rte from scratch using the popular textarea / editable iframe switch and it has taken quite a beating and come out on top. I’d disagree that is such a complex undertaking that you should stay away completely - but it’s worth asking the question why you would write your own.
If you are very comfortable with HTML and Javascript and the features can be kept simple(bold,italic,align,numbered list,bullet list,indent,outdent,undo,redo,edit source) it’s not a ridiculous amount of work.
Sorting out paste is one of the tricker parts (some people avoid that though with a special paste from word feature). Happy to help if you want to give it a shot and run into problems
–
These are essential reading:
http://www.mozilla.org/editor/ie2midas.html
and here is the basic shell of my version:
RichTextEditor = {
// Create an array of hash groups with the default tools that use execCommand
tools: [],
init: function(textarea) {
},
createDocument: function() {
},
updateTextarea: function() {
},
updateIframe: function() {
},
toggleSource: function() {
},
formatSelection: function() {
},
addContent: function(content) {
},
setContent: function(content) {
},
getContent: function() {
},
editorCommand: function(command, options) {
},
getSelection: function() {
},
getSelectedContainer: function() {
},
submitHandler: function(event) {
},
editorKeyUpHandler: function(event) {
},
cleanHTML: function() {
}
}
Keep it simple :tup: