@mocanvas/mocanvas · function

getEmbedInfo

declare function getEmbedInfo(definitions: readonly EmbedDefinition[], url: string, config?: EmbedConfig): EmbedInfo | undefined

Resolve a url against a permit list, in both directions.

Two passes, in this order: toEmbedUrl (the url is a page url), then fromEmbedUrl (the url is already an embed url and the page url has to be recovered). That is what makes a shared link and an already-embeddable link both work from one entry point.

Every url-parsing throw is swallowed: garbage input comes back as undefined rather than as an exception inside somebody's onChange handler.

Unlike getEmbedDefinition the permit list is the first argument and is required, because the caller is usually a picker deciding what it will accept rather than the shape util deciding what it will render.

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.