add a command command
This commit is contained in:
5
packages/core/src/commands/command.ts
Normal file
5
packages/core/src/commands/command.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { Command } from '../types'
|
||||||
|
|
||||||
|
export default (fn: (props: Parameters<Command>[0]) => boolean): Command => props => {
|
||||||
|
return fn(props)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Extension } from '../Extension'
|
import { Extension } from '../Extension'
|
||||||
import blur from '../commands/blur'
|
import blur from '../commands/blur'
|
||||||
import clearContent from '../commands/clearContent'
|
import clearContent from '../commands/clearContent'
|
||||||
|
import command from '../commands/command'
|
||||||
import clearNodes from '../commands/clearNodes'
|
import clearNodes from '../commands/clearNodes'
|
||||||
import deleteSelection from '../commands/deleteSelection'
|
import deleteSelection from '../commands/deleteSelection'
|
||||||
import extendMarkRange from '../commands/extendMarkRange'
|
import extendMarkRange from '../commands/extendMarkRange'
|
||||||
@@ -43,6 +44,10 @@ export const Commands = Extension.create({
|
|||||||
* Normalize nodes to a simple paragraph.
|
* Normalize nodes to a simple paragraph.
|
||||||
*/
|
*/
|
||||||
clearNodes,
|
clearNodes,
|
||||||
|
/**
|
||||||
|
* Define a command inline.
|
||||||
|
*/
|
||||||
|
command,
|
||||||
/**
|
/**
|
||||||
* Delete the selection, if there is one.
|
* Delete the selection, if there is one.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user