mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-08 04:18:06 +08:00
18 lines
372 B
TypeScript
18 lines
372 B
TypeScript
import { Editor } from '../Editor'
|
|
|
|
type InsertText = (value: string) => any
|
|
|
|
declare module '../Editor' {
|
|
interface Editor {
|
|
insertText: InsertText,
|
|
}
|
|
}
|
|
|
|
export default (next: Function, editor: Editor, value: string): InsertText => () => {
|
|
const { view, state } = editor
|
|
const transaction = state.tr.insertText(value)
|
|
|
|
view.dispatch(transaction)
|
|
next()
|
|
}
|