Files
AFFiNE-Mirror/blocksuite/affine/blocks/image/src/configs/slash-menu.ts
T
Saul-Mirone 1f45cc5dec refactor(editor): unify directories naming (#11516)
**Directory Structure Changes**

- Renamed multiple block-related directories by removing the "block-" prefix:
  - `block-attachment` → `attachment`
  - `block-bookmark` → `bookmark`
  - `block-callout` → `callout`
  - `block-code` → `code`
  - `block-data-view` → `data-view`
  - `block-database` → `database`
  - `block-divider` → `divider`
  - `block-edgeless-text` → `edgeless-text`
  - `block-embed` → `embed`
2025-04-07 12:34:40 +00:00

33 lines
972 B
TypeScript

import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands';
import { type SlashMenuConfig } from '@blocksuite/affine-widget-slash-menu';
import { ImageIcon } from '@blocksuite/icons/lit';
import { insertImagesCommand } from '../commands';
import { PhotoTooltip } from './tooltips';
export const imageSlashMenuConfig: SlashMenuConfig = {
items: [
{
name: 'Image',
description: 'Insert an image.',
icon: ImageIcon(),
tooltip: {
figure: PhotoTooltip,
caption: 'Photo',
},
group: '4_Content & Media@1',
when: ({ model }) =>
model.doc.schema.flavourSchemaMap.has('affine:image'),
action: ({ std }) => {
const [success, ctx] = std.command
.chain()
.pipe(getSelectedModelsCommand)
.pipe(insertImagesCommand, { removeEmptyLine: true })
.run();
if (success) ctx.insertedImageIds.catch(console.error);
},
},
],
};