@mocanvas/mocanvas · function

richTextToBlocks

declare function richTextToBlocks(source: RichTextSource): RichTextBlock[]

Flatten a document to the blocks the renderers draw: one block per top-level block node (a paragraph, a heading, a list item), each a list of styled runs.

A hardBreak starts a new block, so blocks and the lines of richTextToText line up one for one.

Mentioned here

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.