add a command command

This commit is contained in:
Philipp Kühn
2020-11-17 14:38:42 +01:00
parent 8d516993a1
commit c71851e14c
2 changed files with 10 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import { Command } from '../types'
export default (fn: (props: Parameters<Command>[0]) => boolean): Command => props => {
return fn(props)
}

View File

@@ -1,6 +1,7 @@
import { Extension } from '../Extension'
import blur from '../commands/blur'
import clearContent from '../commands/clearContent'
import command from '../commands/command'
import clearNodes from '../commands/clearNodes'
import deleteSelection from '../commands/deleteSelection'
import extendMarkRange from '../commands/extendMarkRange'
@@ -43,6 +44,10 @@ export const Commands = Extension.create({
* Normalize nodes to a simple paragraph.
*/
clearNodes,
/**
* Define a command inline.
*/
command,
/**
* Delete the selection, if there is one.
*/