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

stateFromHTML reorders content

Open tfsjohan opened this issue 7 years ago • 1 comments

I have an issue where I can get crappy HTML and it breaks stateFromHTML in a weird way.

Givning it html like this:

<h1>Heading</h1>Some content without a wrapping tag<h2>Heading 2</h2>

Is parsed to:

<p>Some content without a wrapping tag</p><h1>Heading 1</h1><h2>Heading 2</h2>

I would like to wrap the content in a P tag, but I don't want it to get reordered.

tfsjohan avatar Oct 23 '18 20:10 tfsjohan

This is a known issue. I do believe this has been an issue since the logic was first written 4-5 years ago.

Specifically the behavior is this: Any content that is not wrapped in a block gets put at the top of the document before all content that IS wrapped in a block.

I would need to do some non-trivial refactoring to change this behavior.

sstur avatar Dec 21 '18 19:12 sstur