$user-keymap.d.ts 902 B

123456789101112131415161718
  1. import type { Ctx, SliceType } from '@milkdown/ctx';
  2. import type { Command } from '@milkdown/prose/state';
  3. import type { $Ctx } from '../$ctx';
  4. import type { $Shortcut, Keymap } from '../$shortcut';
  5. export type KeymapConfig<K extends string> = Record<K, string | string[]>;
  6. export interface KeymapItem {
  7. shortcuts: string | string[];
  8. command: (ctx: Ctx) => Command;
  9. }
  10. export type UserKeymapConfig<Key extends string> = Record<Key, KeymapItem>;
  11. export type $UserKeymap<N extends string, Key extends string> = [$Ctx<KeymapConfig<Key>, `${N}Keymap`>, $Shortcut] & {
  12. key: SliceType<KeymapConfig<Key>, `${N}Keymap`>;
  13. keymap: Keymap;
  14. ctx: $Ctx<KeymapConfig<Key>, `${N}Keymap`>;
  15. shortcuts: $Shortcut;
  16. };
  17. export declare function $useKeymap<N extends string, Key extends string>(name: N, userKeymap: UserKeymapConfig<Key>): $UserKeymap<N, Key>;
  18. //# sourceMappingURL=$user-keymap.d.ts.map