tiptap/packages/core/src/commands/command.ts

15 lines
300 B
TypeScript
Raw Normal View History

2021-02-10 16:59:35 +08:00
import { Command, Commands } from '../types'
2020-11-17 21:38:42 +08:00
2020-11-18 23:43:27 +08:00
/**
* Define a command inline.
*/
2021-02-10 16:59:35 +08:00
export const command: Commands['command'] = fn => props => {
2020-11-17 21:38:42 +08:00
return fn(props)
}
2021-02-10 16:59:35 +08:00
declare module '@tiptap/core' {
interface Commands {
command: (fn: (props: Parameters<Command>[0]) => boolean) => Command,
}
}