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

17 lines
362 B
TypeScript
Raw Normal View History

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