Files
tiptap/packages/core/src/commands/clearContent.ts
2021-06-04 21:56:29 +02:00

17 lines
401 B
TypeScript

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