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).

+1


source to share


2 answers


Why not give TinyMCE a go? It's nice and pretty sophisticated - you just need to combine it with PHP and you can save the content :)



0


source


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; -)

+6


source







All Articles