mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-04 17:07:50 +08:00
23 lines
507 B
TypeScript
23 lines
507 B
TypeScript
import { Command, RawCommands } from '../types'
|
|
|
|
declare module '@tiptap/core' {
|
|
interface Commands {
|
|
insertText: {
|
|
/**
|
|
* Insert a string of text at the current position.
|
|
*/
|
|
insertText: (value: string) => Command,
|
|
}
|
|
}
|
|
}
|
|
|
|
export const insertText: RawCommands['insertText'] = value => ({ tr, dispatch }) => {
|
|
console.warn('[tiptap warn]: insertText() is deprecated. please use insertContent() instead.')
|
|
|
|
if (dispatch) {
|
|
tr.insertText(value)
|
|
}
|
|
|
|
return true
|
|
}
|