add insertText command
This commit is contained in:
10
packages/tiptap-commands/src/commands/insertText.js
Normal file
10
packages/tiptap-commands/src/commands/insertText.js
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user