Files
tiptap/packages/core/src/commands/clearContent.ts
2021-04-25 21:04:26 +02:00

17 lines
395 B
TypeScript

import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
clearContent: {
/**
* Clear the whole document.
*/
clearContent: (emitUpdate?: boolean) => Command,
}
}
}
export const clearContent: RawCommands['clearContent'] = (emitUpdate = false) => ({ commands }) => {
return commands.setContent('', emitUpdate)
}