The key insight in Draft.js is that it's incredibly difficult to keep your model in sync with the browser's contenteditable behavior unless you intercept many of the behaviors and perform them entirely in the model, then change the DOM accordingly. Medium found the same thing when building their editor:
https://medium.com/medium-eng/why-contenteditable-is-terribl...
In order to build high-quality text editors, you need to be in control of what's happening in the DOM. There's obviously many ways to control the DOM. React is a solid base for this, as are many other libraries. Facebook uses React extensively so it made sense to use as a base for Draft to avoid needing to essentially rewrite React and to make it even easier to integrate with existing React apps. Of course, you can also use Draft easily inside a non-React app.
The entire Draft model is also separate code decoupled from the UI and you're free to use the model and implement the views yourself if you're allergic to React or aren't targeting the DOM. The Facebook Groups app uses Draft's model but implements custom views for it in React Native.
Most modern rich text editors have or are moving towards having a document model that maps to the DOM, ideally also producing compact and canonical output. Quill's new document model Parchment takes this approach as well though I admit I borrowed the idea from the Etherpad guys, and some design ideas from React as well [1]. I have not had the time to dig into Draft.js in depth but Facebook has made many high quality contributions to open source and looking forward to borrowing more ideas.
Draft.JS is a controlled input. The view is completely derived from the model. This eliminates whole classes of browser and editor bugs.
It's also makes the editor really easy to extend. You can add new object types and complex styling without having to worry about all the nuances of text editing.
For example you could highlight hashtags by giving the editor a regex to match and then tell it which styles your hashtag should be decorated with. Draft.js handles creating and removing tags as you type, drag and drop, copy, paste, etc.
Undo and other text editing facilities aren't completely nonfunctional, they just become broken and unpredictable. For example, these steps:
1. Load http://facebook.github.io/draft-js/ 2. Click in the text box 3. Type 'hello' on the keyboard 4. Using the mouse, choose Edit -> Undo
The text box will show "h" instead of being empty. Do you see this too?
Note that cmd-Z won't reproduce this since the page tries to handle that itself to work around these bugs.
The Editing Task Force is working on opening necessary APIs so editor implementors could integrate with all the native features. I wrote an article about the effort [3]. It's a bit outdated now, but explains what are the goals.
[1] https://github.com/w3c/editing/issues
[2] https://github.com/w3c/editing/issues/79
[3] https://medium.com/content-uneditable/fixing-contenteditable...
Anyway this approach is the only good one if you don't want to produce crappy HTML that will end up on your site. TinyMCE and the rest are obsolete, and editors like DraftJS or mobiledoc-kit are the only viable solutions until browsers offer a new, not broken alternative to content-editable.
I was involved in a project that used contentEditable DOM as the source of truth before I had a chance to work with Draft, and I believe that Draft's model is the best compromise.
Draft does a lot to handle the edge cases where it's possible. IME and spellcheck are two of the big ones.
(disclaimer: I've been out of Facebook for a while so they may have introduced that feature already)
My point is, if you can have a truly reusable component with an API that can be integrated into anywhere (including a React wrapper), what do you gain by making a component that can only live in React and have no other re-usability to speak of?
There are many drawbacks, but React-native is the only benefit as far as I can see, which requires a firm React commitment.
I'm not sure about 3rd party js text editors, but I'm guessing it could be a pain to work with state and props in that context.
I'm not sure how I feel about re-implementing all the things and introducing a React dependency to everything. The lock-in seems okay if React really is the final word in UI frameworks (though it is very large and currently very slow). I am certainly not in this camp, however.
[1] https://github.com/neilj/Squire
[2] https://github.com/quilljs/quill
[3] https://github.com/zenoamaro/react-quill