Draft-js: Pasted paragraphs are not divided into blocks

Created on 13 Jun 2016  路  3Comments  路  Source: facebook/draft-js

If a blockRenderMap is not defined with a 'p' element, pasted HTML with paragraph tags is not divided:

jun-13-2016 18-35-20

Shouldn't the text be splitted into two 'unstyled' blocks?
Is this the intended behavior or a bug?

Most helpful comment

@mitermayer Cool! I checkout draft-js 0.9.0, cherry-pick your commit and it works.

But I find a problem that if I set blockRenderMap like below:

unstyled: {
  element: 'p',
  aliasedElements: 'div',
},

and I try to paste some paragraph like <p>123</p><p>234</p> into my editor, it fails to a block again.

I have noticed that in https://github.com/facebook/draft-js/blob/master/src/model/encoding/convertFromHTMLToContentBlocks.js#L173 it excludes unstyledElement. I wonder why is unstyledElement excluded in BlockMapSupportedTags? Does it cause my problem? Or I misunderstand something here?

Thanks a lot.

All 3 comments

Similar issue: On my Mac, pasted paragraphs from Microsoft Word are not divided into blocks, but Pages works right.

This issue has been fixed by https://github.com/facebook/draft-js/pull/828

@mitermayer Cool! I checkout draft-js 0.9.0, cherry-pick your commit and it works.

But I find a problem that if I set blockRenderMap like below:

unstyled: {
  element: 'p',
  aliasedElements: 'div',
},

and I try to paste some paragraph like <p>123</p><p>234</p> into my editor, it fails to a block again.

I have noticed that in https://github.com/facebook/draft-js/blob/master/src/model/encoding/convertFromHTMLToContentBlocks.js#L173 it excludes unstyledElement. I wonder why is unstyledElement excluded in BlockMapSupportedTags? Does it cause my problem? Or I misunderstand something here?

Thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings