import type { EditorHost } from '@blockeditor/lit'; import type { BlockModel } from '@blockeditor/store'; import type { TemplateResult } from 'lit'; import type { AffineTextAttributes } from '../../../_common/inline/presets/affine-inline-specs.js'; import type { PageBlockComponent } from '../../../page-block/types.js'; export type SlashMenuOptions = { /** * If return false, the slash menu will not show * * If return string, the slash menu will show and the string will be clear after the slash menu is activated */ isTriggerKey: (e: KeyboardEvent) => false | string; menus: { name: string; items: ((options: { pageElement: PageBlockComponent; model: BlockModel; }) => SlashItem[]) | SlashItem[]; }[]; }; export type SlashItem = { name: string; /** * search alias */ alias?: string[]; /** * size 20x20 */ icon: TemplateResult<1>; suffix?: TemplateResult<1>; showWhen?: (model: BlockModel, pageElement: PageBlockComponent) => boolean; disabled?: boolean; action: ({ pageElement, model, }: { pageElement: PageBlockComponent; model: BlockModel; }) => void | Promise; }; export type InternSlashItem = SlashItem & { groupName: string; }; export declare function collectGroupNames(menuItem: InternSlashItem[]): string[]; export declare function insertContent(editorHost: EditorHost, model: BlockModel, text: string, attributes?: AffineTextAttributes): void; export declare function formatDate(date: Date): string; export declare function insideDatabase(model: BlockModel): boolean; export declare function insideDataView(model: BlockModel): boolean; export declare function withRemoveEmptyLine(fn: SlashItem['action']): SlashItem['action']; //# sourceMappingURL=utils.d.ts.map