tiptap/packages/core/src/commands/clearContent.ts
2021-02-16 18:39:37 +01:00

17 lines
394 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)
}