I'm trying to understand how CKeditor works. It seems to build on contentEditable, yet the markup that it produces seems much cleaner than what I'm used to seeing from raw contentEditable. Is this the responsibility of the dataProcessor? Is dataProcessor continually cleaning up the markup?
So I've been reading through the documentation and I'm finding it quite vague. I understand that there's a backing textarea whose contents mirror what's shown in the UI. Is dataProcessor the mirror here? Or is it unrelated?
The dataProcessor has toHtml and toDataFormat. When exactly are these being called? My guess is that toDataFormat is called frequently as the user is modifying what's displayed. (It can't be on every change, or the performance would be terrible. Is it being called periodically?) And then toHtml must be getting called immediately afterward, so that we have a canonical view of the model. But I don't understand how this can be done seamlessly.
So I've been reading through the documentation and I'm finding it quite vague. I understand that there's a backing textarea whose contents mirror what's shown in the UI. Is dataProcessor the mirror here? Or is it unrelated?
The dataProcessor has toHtml and toDataFormat. When exactly are these being called? My guess is that toDataFormat is called frequently as the user is modifying what's displayed. (It can't be on every change, or the performance would be terrible. Is it being called periodically?) And then toHtml must be getting called immediately afterward, so that we have a canonical view of the model. But I don't understand how this can be done seamlessly.
Re: Understanding dataProcessor
There are lots of code that takes care of trying to clean up the contents, listening for enter key, not using the browser's execCommand and using instead its own logic to apply styles, etc...
It's not a single part, but the whole editor is developed trying to workaround all the problems and make everything work as expected in every browser.