Hey, first off let me just say thanks for the awesome library! Currently getting familiar with it, and implementing HTML parsing to be able to store content as HTML in the database, but use Draft as the editor. Love the concept of it.
I noticed that convertToRaw and convertFromRaw aren't quite parallel, and I was wondering why? convertFromRaw returns an array of ContentBlocks that you have to convert into a ContentState yourself, and convertToRaw takes a fully-formed ContentState.
It seems like it would be nicer for consistency if convertFromRaw returned a ContentState instead of an array of ContentBlocks. (Or vice versa if there's a reason for wanting the lower-level array of blocks.)
You're absolutely right, it's an odd asymmetry.
I don't think I made the decision intentionally, it just turned out that way. I was probably thinking I'd want to have flexibility with selectionBefore and selectionAfter within convertFromRaw, but in practice I doubt anything was really ever gained.
convertFromRaw should probably be changed to return a full ContentState. It would be a breaking change, but it would nicely eliminate the need to use ContentState.createFromBlockArray all the time.
Would you like to submit a PR for this?
Most helpful comment
You're absolutely right, it's an odd asymmetry.
I don't think I made the decision intentionally, it just turned out that way. I was probably thinking I'd want to have flexibility with
selectionBeforeandselectionAfterwithinconvertFromRaw, but in practice I doubt anything was really ever gained.convertFromRawshould probably be changed to return a fullContentState. It would be a breaking change, but it would nicely eliminate the need to useContentState.createFromBlockArrayall the time.