@mocanvas/mocanvas · function
declare function readRichText(props: unknown, key?: string): RichTextA shape's label as a rich-text document — the reader every other label read goes through.
A record can carry either spelling, or both, or both *disagreeing*: a v5
writer sets props.richText and leaves props.text at its default, a
pre-v5 writer does the reverse, and a partial update touches one without the
other. So the rule is stated once, here:
1. a rich-text document that actually says something wins — it is the
canonical spelling and the only one that can carry formatting;
2. otherwise a non-empty props.text is lifted into a document;
3. otherwise the label is empty, and the stored document (if any) is kept so
an empty-but-structured document survives a round trip.
An empty label is one empty paragraph, which is what this format spells "nothing typed yet" — never a document with no content at all.
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.