@mocanvas/editor · function

normalizeLoadedRecords

declare function normalizeLoadedRecords(records: readonly UnknownRecord[], options: NormalizeOptions): NormalizeResult

Rewrite loaded records so the shape utils see the props they declare.

Per shape: props.richText is KEPT and props.text is derived from it for utils that only read plain text, packed freehand segments[].path becomes segments[].points, and any prop the util declares a default for but the file omits is filled in from that default. Props the util does not declare are left untouched so a round trip preserves them, and shapes of a type with no registered util are passed through unchanged.

Records are only copied when something actually changes.

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.