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 {
|
2020-08-17 22:38:13 +08:00
|
|
|
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
|
|
|
}
|