import { Schema } from 'prosemirror-model'; import { Transaction, Plugin } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import { Command } from 'prosemirror-commands'; import { ToastMark } from './toastmark'; import { Emitter } from './event'; export interface Context { schema: Schema; eventEmitter: Emitter; } export interface MdContext extends Context { toastMark: ToastMark; } export interface SpecContext extends Context { view: EditorView; } export interface MdSpecContext extends SpecContext { toastMark: ToastMark; } export type DefaultPayload = Record; export type Payload = T extends infer P ? P : any; export type Dispatch = (tr: Transaction) => void; export type EditorCommand = (payload?: Payload) => Command; export type EditorCommandMap = Record>; export type EditorCommandFn = (payload?: Payload) => boolean | void; export type EditorAllCommandMap = Record>; export interface SpecManager { commands( view: EditorView, addedCommands?: Record ): EditorAllCommandMap; keymaps(useCommandShortcut: boolean): Plugin[]; setContext(context: SpecContext): void; }