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

16 lines
292 B
TypeScript
Raw Normal View History

2020-09-21 05:19:27 +08:00
import { Command } from '../Editor'
2019-12-08 07:16:44 +08:00
2020-09-21 05:19:27 +08:00
type InsertTextCommand = (value: string) => Command
2020-04-22 05:22:27 +08:00
2019-12-15 06:54:20 +08:00
declare module '../Editor' {
2020-09-22 16:49:38 +08:00
interface Commands {
insertText: InsertTextCommand,
2019-12-08 07:16:44 +08:00
}
}
2020-09-21 05:19:27 +08:00
export const insertText: InsertTextCommand = value => ({ tr }) => {
tr.insertText(value)
2019-12-15 06:54:20 +08:00
2020-09-21 05:19:27 +08:00
return true
2019-12-08 07:16:44 +08:00
}