return editor for all core command types
This commit is contained in:
@@ -7,19 +7,19 @@ interface Range {
|
||||
to: number,
|
||||
}
|
||||
|
||||
type ReplaceWithNode = (
|
||||
type: NodeType,
|
||||
type ReplaceWithNodeCommand = (
|
||||
typeOrName: NodeType,
|
||||
attrs: {},
|
||||
range?: Range,
|
||||
) => any
|
||||
) => Editor
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
replaceText: ReplaceWithNode,
|
||||
replaceText: ReplaceWithNodeCommand,
|
||||
}
|
||||
}
|
||||
|
||||
export default (next: Function, editor: Editor): ReplaceWithNode => (typeOrName, attrs, range) => {
|
||||
export default (next: Function, editor: Editor) => (typeOrName: NodeType, attrs: {}, range?: Range) => {
|
||||
const { view, state, schema } = editor
|
||||
const { $from, $to } = state.selection
|
||||
const type = getNodeType(typeOrName, schema)
|
||||
|
||||
Reference in New Issue
Block a user