add insertText command

This commit is contained in:
Philipp Kühn
2018-10-02 23:01:53 +02:00
parent 5aa206f09e
commit 4a31f8f1ca
2 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
export default function (text = '') {
return (state, dispatch) => {
const { $from } = state.selection
const { pos } = $from.pos
dispatch(state.tr.insertText(text, pos))
return true
}
}

View File

@@ -38,6 +38,7 @@ import {
textblockTypeInputRule,
} from 'prosemirror-inputrules'
import insertText from './commands/insertText'
import markInputRule from './commands/markInputRule'
import removeMark from './commands/removeMark'
import replaceText from './commands/replaceText'
@@ -86,6 +87,7 @@ export {
textblockTypeInputRule,
// custom
insertText,
markInputRule,
removeMark,
replaceText,