This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
convertFromHTML
merged multiple unstyled
tags into one
#738
Comments
related issue: #523 |
colinjeanne
added a commit
to textioHQ/draft-js
that referenced
this issue
Jan 9, 2017
This change fixes facebookarchive#738 by ensuring that `convertFromHTMLToContentBlocks` counts unstyled blocks as blocks and by moving the logic to suppress a block's type into that function. Previously the existence of any tag other than the unstyled tag would cause unstyled blocks not to be parsed as blocks (but, curiously, the aliases of the unstyled tag would be parsed as blocks). This is mean to handle a case like ``` <div><h2>Hello</h2></div> ``` ensuring that the final block is a `header-two` but breaks with examples like ``` <h2>Hello</h2> <div>world!</div> <div>Goodbye!</div> ``` which parses as two blocks with the two divs being combined into a single unstyled block. The core issue is that not counting the unstyled tag when an interesting tag appears anywhere in the document is a global problem to a local issue: the fix is to instead consider each tree under a block individually with unstyled blocks deferring their final type to whatever the next lowest block type is.
DawnWright
pushed a commit
to WeTransfer/draft-js
that referenced
this issue
May 10, 2017
This change fixes facebookarchive#738 by ensuring that `convertFromHTMLToContentBlocks` counts unstyled blocks as blocks and by moving the logic to suppress a block's type into that function. Previously the existence of any tag other than the unstyled tag would cause unstyled blocks not to be parsed as blocks (but, curiously, the aliases of the unstyled tag would be parsed as blocks). This is mean to handle a case like ``` <div><h2>Hello</h2></div> ``` ensuring that the final block is a `header-two` but breaks with examples like ``` <h2>Hello</h2> <div>world!</div> <div>Goodbye!</div> ``` which parses as two blocks with the two divs being combined into a single unstyled block. The core issue is that not counting the unstyled tag when an interesting tag appears anywhere in the document is a global problem to a local issue: the fix is to instead consider each tree under a block individually with unstyled blocks deferring their final type to whatever the next lowest block type is.
ukrbublik
added a commit
to ukrbublik/draft-js-mod
that referenced
this issue
Jan 8, 2018
Related to issue facebookarchive#1389 (vice-versa) Fixes issue facebookarchive#738
I think this is exactly the same as #523? |
ericrockey
pushed a commit
to WeTransfer/draft-js
that referenced
this issue
Oct 25, 2018
This change fixes facebookarchive#738 by ensuring that `convertFromHTMLToContentBlocks` counts unstyled blocks as blocks and by moving the logic to suppress a block's type into that function. Previously the existence of any tag other than the unstyled tag would cause unstyled blocks not to be parsed as blocks (but, curiously, the aliases of the unstyled tag would be parsed as blocks). This is mean to handle a case like ``` <div><h2>Hello</h2></div> ``` ensuring that the final block is a `header-two` but breaks with examples like ``` <h2>Hello</h2> <div>world!</div> <div>Goodbye!</div> ``` which parses as two blocks with the two divs being combined into a single unstyled block. The core issue is that not counting the unstyled tag when an interesting tag appears anywhere in the document is a global problem to a local issue: the fix is to instead consider each tree under a block individually with unstyled blocks deferring their final type to whatever the next lowest block type is.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Based on
jsdom
, it is easy to reproduce this bug:Providing
<h1>Title</h1><div>Hello</div><div>World</div>
,convertFromHTML
outputs two blocks:instead of three:
https://github.com/facebook/draft-js/blob/master/src/model/encoding/convertFromHTMLToContentBlocks.js#L504
might be the cause of this. Should we add 'div' to
workingBlocks
to make it be [ 'blockquote', 'figure', 'h1', 'h2', 'h3','h4','h5','h6','li','pre','div'] ?Draft-js version: 0.9.1
The text was updated successfully, but these errors were encountered: