lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: highlight TextFormatType is missing in importDOM losing state

Open bfritscher opened this issue 1 year ago • 1 comments

Pull request https://github.com/facebook/lexical/pull/3583 by @moy2010 added a new textformat (which is helpful), but if we use HTML to serialize it gets lost because importDOM is not parsing the mark tag in https://github.com/facebook/lexical/blob/20e4ea1687bd846653a0cc2df8cbb610d8308307/packages/lexical/src/nodes/LexicalTextNode.ts#L552

Also the devtools do not show formatting for this new highlight feature because its mising in https://github.com/facebook/lexical/blob/20e4ea1687bd846653a0cc2df8cbb610d8308307/packages/lexical-devtools-core/src/generateContent.ts#L58

Lexical version: 0.16.1

Steps To Reproduce

  1. exportDOM a TextNode with format highlighting
  2. importDOM mark does not get parsed back to highligted text.,

bfritscher avatar Aug 06 '24 19:08 bfritscher

This would be a straightforward PR to write if you were interested, or you could override the importDOM using the html property of your EditorConfig if you needed a solution that would work without upgrading lexical. It doesn't look like any code in the monorepo is using IS_HIGHLIGHT which is likely why it was forgotten here.

etrepum avatar Aug 12 '24 14:08 etrepum