If anyone is still looking, I also ended up using draft-convert, I also had to preserve links as well (can preserve more stuff using the decordator)...and my code was as follows:
const Link = (props) => {
const {url} = props.contentState.getEntity(props.entityKey).getData();
return (
{props.children}
);
};
const findLinkEntities = (contentBlock, callback, contentState) => {
contentBlock.findEntityRanges(
(character) => {
const entityKey = character.getEntity();
return (
entityKey != null && contentState.getEntity(entityKey).getType() === 'LINK'
);
},
callback
);
};
const decorator = new CompositeDecorator([
{
strategy: findLinkEntities,
component: Link,
}
]);
const html = '...whatever...html';
const blocksFromHTML = convertFromHTML({
htmlToEntity: (nodeName, node, createEntity) => {
if (nodeName === 'a') {
return createEntity('LINK', 'MUTABLE', { url: node.href });
}
}
})(html);
const contentState = ContentState.createFromBlockArray(
blocksFromHTML.getBlocksAsArray(),
blocksFromHTML.getEntityMap
);
editorState = EditorState.createWithContent(contentState, decorator);
...
...
editorState={editorState}
...etc
/>