@mocanvas/mocanvas · function
declare function toRichText(text: string): RichTextConvert a plain string into a rich-text document.
Each line becomes a paragraph; an empty line becomes a paragraph with no
content ({ type: "paragraph" }), which is exactly how the format spells an
empty label. toRichText("") is therefore a one-empty-paragraph document
rather than an empty one, so a shape created from it still has a caret line.
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.