mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-01 01:19:03 +08:00
838 B
838 B
clearContent
The clearContent
command deletes the current document.
Keep in mind that the editor will enforce the configured schema, and the document won’t be null
. The default Document
expects to have at least one block node, which is the paragraph by default. In other words: Even after running that command the document will have at least one (empty) paragraph.
See also: setContent, insertContent
Parameters
emitUpdate: boolean (false)
By default, it doesn’t trigger the update event. Passing true
doesn’t prevent triggering the update event.
Usage
// Remove all content from the document
editor.commands.clearContent()
// Remove all content, and trigger the `update` event
editor.commands.clearContent(true)