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,
|
textblockTypeInputRule,
|
||||||
} from 'prosemirror-inputrules'
|
} from 'prosemirror-inputrules'
|
||||||
|
|
||||||
|
import insertText from './commands/insertText'
|
||||||
import markInputRule from './commands/markInputRule'
|
import markInputRule from './commands/markInputRule'
|
||||||
import removeMark from './commands/removeMark'
|
import removeMark from './commands/removeMark'
|
||||||
import replaceText from './commands/replaceText'
|
import replaceText from './commands/replaceText'
|
||||||
@@ -86,6 +87,7 @@ export {
|
|||||||
textblockTypeInputRule,
|
textblockTypeInputRule,
|
||||||
|
|
||||||
// custom
|
// custom
|
||||||
|
insertText,
|
||||||
markInputRule,
|
markInputRule,
|
||||||
removeMark,
|
removeMark,
|
||||||
replaceText,
|
replaceText,
|
||||||
|
|||||||
Reference in New Issue
Block a user