Skip to content

BlockSuite API Documentation / @blocksuite/affine-block-embed / EmbedIframeConfig

Type Alias: EmbedIframeConfig

EmbedIframeConfig = object

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:54

Define the config of an embed iframe block

Example

ts
{
 *   name: 'spotify',
 *   match: (url: string) => spotifyRegex.test(url),
 *   buildOEmbedUrl: (url: string) => {
 *     const match = url.match(spotifyRegex);
 *     if (!match) {
 *       return undefined;
 *     }
 *     const encodedUrl = encodeURIComponent(url);
 *     const oEmbedUrl = `${spotifyEndpoint}?url=${encodedUrl}`;
 *     return oEmbedUrl;
 *   },
 *   useOEmbedUrlDirectly: false,
 *   options: {
 *     defaultWidth: '100%',
 *     defaultHeight: '152px',
 *     allow: 'autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture'
 *   }
 * }

Properties

buildOEmbedUrl()

buildOEmbedUrl: (url) => string | undefined

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:66

The function to build the oEmbed URL for fetching embed data

Parameters

url

string

Returns

string | undefined


match()

match: (url) => boolean

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:62

The function to match the url

Parameters

url

string

Returns

boolean


name

name: string

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:58

The name of the embed iframe block


options?

optional options: IframeOptions

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:74

The options for the iframe


useOEmbedUrlDirectly

useOEmbedUrlDirectly: boolean

Defined in: packages/affine/blocks/block-embed/src/embed-iframe-block/extension/embed-iframe-config.ts:70

Use oEmbed URL directly as iframe src without fetching oEmbed data