draft-js-utils icon indicating copy to clipboard operation
draft-js-utils copied to clipboard

stateFromHTML -> stateToMarkdown ordering issues

Open jtsylve opened this issue 7 years ago • 0 comments

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?

jtsylve avatar Jun 22 '18 17:06 jtsylve