UNPKG

@tldraw/tlschema

Version:

A tiny little drawing app (schema).

26 lines (25 loc) 533 B
import { T } from "@tldraw/validate"; const richTextValidator = T.object({ type: T.string, content: T.arrayOf(T.unknown) }); function toRichText(text) { const lines = text.split("\n"); const content = lines.map((text2) => { if (!text2) { return { type: "paragraph" }; } return { type: "paragraph", content: [{ type: "text", text: text2 }] }; }); return { type: "doc", content }; } export { richTextValidator, toRichText }; //# sourceMappingURL=TLRichText.mjs.map