Alternative to ContentEditable
I'm in the process of building a Rich Text editor and originally planned to use contentEditable, but it turns out the results are extremely inconsistent and the output HTML is often broken.
I was wondering if there are alternatives to using contentEditable, like the way Google Docs does it (they built their own engine).
source to share
Even Google Docs is built on contentEditable. They use it in a different way, however, most editors do there.
When you focus a region of the document, it appears to be focused due to the fake caret. The actual focus goes on <iframe>
with the keyboard listening settings. The engine (kix) then changes the document area based on the keys pressed.
This is awesome because there are really no major cross-browser inconsistencies, since the browser is not the one modifying the DOM.
The only alternative I can think of might be simple text input instead of the contentEditable element, but why bother with issues like max length when you can just use contentEditable; -)
source to share