draft-js-utils
draft-js-utils copied to clipboard
Convert raw HTML containing datasets into a draftJS contentBlock and back again
Originally posted here.
The original post by @rpmonteiro is as follows:
We're trying to convert this into a valid contentBlock that draftJS can display (it's a custom entity of type 'PERSON'), and then eventually do the opposite with the export-html.
<p>This is a <span class="person" id="123" data-tag-id="100">special</span> element.</p>
How would we go about this? Is it possible using this library? We can't seem to hook any kind of data attributes when doing stateFromElement passing customBlockFn() in the options.
Thank you!
@rpmonteiro: we're working on a solution for this which is tracked here.