I am looking for a very clean project to add cross-browser JavaScript API to contenteditable div.
If it has UI, then it should be possible not to load it (as opposed to disabling it) or completely remove from sources.
I am looking for basic features really without huge focus on backward-compatibility but rather a cleaner code.
Some of the features, I would expect from this API would be:
- Insert HTML snippet at the position of the cursor
- Clean up contents after paste (such as spans and font sizes)
- Return node, where cursor currently is positioned
- Add new item to item list
I suppose I could code them with some jQuery, but if someone have it, why not re-use it.
You could use the one Google use –
http://closure-library.googlecode.com/svn/docs/namespace_goog_editor.html
http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/editor/field_basic.html
If your concern about cleaner code relates to maintainability/extensibility then all the code in the Closure library is well documented and all variables/methods are verbose in their naming (this is because the Closure Compiler will take care of minifying them for the client).