import type { EditorHost } from '@blockeditor/lit'; import { html, nothing } from 'lit'; import { ref, type RefOrCallback } from 'lit/directives/ref.js'; import { BookmarkIcon, CaptionIcon, CopyIcon, DeleteIcon, DownloadIcon, HighLightDuotoneIcon, } from '../../../_common/icons/index.js'; import { stopPropagation } from '../../../_common/utils/event.js'; import { turnImageIntoCardView } from '../../../attachment-block/utils.js'; import type { ImageBlockModel } from '../../../image-block/index.js'; import { openLeditsEditor } from '../../../image-block/ledits/main.js'; import { copyImage, downloadImage, focusCaption, } from '../../../image-block/utils.js'; export function ImageOptionsTemplate({ editorHost, ref: containerRef, model, blob, abortController, host, }: { editorHost: EditorHost; ref?: RefOrCallback; model: ImageBlockModel; blob?: Blob; abortController: AbortController; /** * @deprecated */ host: EditorHost; }) { const supportAttachment = model.page.schema.flavourSchemaMap.has('affine:attachment'); const readonly = model.page.readonly; return html`
${supportAttachment ? html` { if (!blob) return; abortController.abort(); turnImageIntoCardView(model, blob); }} > ${BookmarkIcon} Turn into Card view ` : nothing} focusCaption(editorHost, model)} > ${CaptionIcon} Caption downloadImage(model)}> ${DownloadIcon} Download copyImage(editorHost, model)}> ${CopyIcon} Copy to clipboard ${DeleteIcon} Delete ${HighLightDuotoneIcon} Edit with LEDITS
`; }