tiptap/packages/core/src/commands/insertText.ts

13 lines
238 B
TypeScript
Raw Normal View History

2020-11-17 04:42:35 +08:00
import { Command } from '../types'
2020-11-05 05:38:52 +08:00
2020-11-18 23:43:27 +08:00
/**
* Insert a string of text at the current position.
*/
export const insertText = (value: string): Command => ({ tr, dispatch }) => {
2020-11-05 05:38:52 +08:00
if (dispatch) {
tr.insertText(value)
}
return true
}