by afiedler · 10y ago · 0 comments
I have only played with it, not used it in production, but if you are using React it could be a good solution.
The one limitation I've seen is that is doesn't really support documents that need a hierarchical model (an example of this would be tables, but also things like "I want a code block within a blockquote").
If you want to see draft.js's document model, I made a tool to do that, too[2].
[1]: https://facebook.github.io/draft-js/ [2]: http://afiedler.github.io/draft-js-dm-demo/
Medium's editor side steps this by just rerendering after each input.
Keyboards on Android Chrome used to emit keycode 0 for every character that was inserted and then mutate the DOM directly. And spelling corrections just mutated he DOM without firing events.
I've found that there are many edge cases in rich content-editing. If your general-purpose editor does something reasonable and constructive with esoteric inputs it's fine.
Draft.js appears to cancel the selection process and drops the typed character wherever the mouse happens to be. Reasonable.