tiptap/packages/core/src/extensions/clearContent.ts

19 lines
420 B
TypeScript
Raw Normal View History

2020-10-23 16:44:30 +08:00
import { Command } from '../Editor'
import { createExtension } from '../Extension'
export const ClearContent = createExtension({
addCommands() {
return {
clearContent: (emitUpdate: Boolean = false): Command => ({ commands }) => {
return commands.setContent('', emitUpdate)
},
}
},
})
declare module '../Editor' {
interface AllExtensions {
ClearContent: typeof ClearContent,
}
}