draft-js-utils
draft-js-utils copied to clipboard
stateFromHTML -> stateToMarkdown ordering issues
I've got a codemirror editor that I've set up to convert pasted HTML to Markdown as follows:
this.editor.on('paste', (cm, e) => {
let html = e.clipboardData.getData('text/html');
let state = stateFromHTML(html)
if (state.hasText()) {
this.setState({ pasted: stateToMarkdown(state) })
} else {
this.setState({ pasted: null })
}
})
While this seems to work mostly well, the issue I'm having is that the markdown seems to be generated out of order. All of the text-based content will be generated first, followed by the lists, and then all of the images. Is it not possible to inline the non-text content properly or am I doing something wrong?