import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands'; import type { SlashMenuConfig } from '@blocksuite/affine-widget-slash-menu'; import { EmbedIcon } from '@blocksuite/icons/lit'; import { insertEmptyEmbedIframeCommand } from '../../commands/insert-empty-embed-iframe'; import { EmbedIframeTooltip } from './tooltip'; export const embedIframeSlashMenuConfig: SlashMenuConfig = { items: [ { name: 'Embed', description: 'For Google Drive, and more.', icon: EmbedIcon(), tooltip: { figure: EmbedIframeTooltip, caption: 'Embed', }, group: '4_Content & Media@5', when: ({ model }) => { return model.store.schema.flavourSchemaMap.has('affine:embed-iframe'); }, action: ({ std }) => { std.command .chain() .pipe(getSelectedModelsCommand) .pipe(insertEmptyEmbedIframeCommand, { place: 'after', removeEmptyLine: true, linkInputPopupOptions: { telemetrySegment: 'slash menu', }, }) .run(); }, }, ], };