TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
6.76k stars 471 forks source link

Bug in 'data-..-color' attributes conversion in tryParseHTMLToBlocks #1229

Open marsee339 opened 2 weeks ago

marsee339 commented 2 weeks ago

Describe the bug

After editor.blocksToHTMLLossy - the stylization of both blocks has been correctly preserved

<p data-text-color="red">All text</p>
<p><span data-text-color="red">Part </span>of text</p><p></p>

After editor.tryParseHTMLToBlocks - the color (text or background) attributes for 'p' will be removed, but they will remain for span

<p>All text</p>
<p><span data-text-color="red">Part </span>of text</p><p></p>

To Reproduce Reproduced on the demo https://www.blocknotejs.org/docs/editor-api/converting-blocks#parsing-html-to-blocks with first markup

Or create 2 blocks with a style, e.g. msedge_B2BNj42WAU The first block has the text (or background) color set for the whole block, the second block only for part of the text