clearContent 命令会删除当前文档。编辑器会保留满足其 schema 所需的内容,例如使用默认设置的 StarterKit 时,会保留一个空段落。
另见:setContent、insertContent
参数
emitUpdate?: boolean (true)
是否发出更新事件。默认为 true(注意:在 v2 中从 false 更改为此)。
示例
// 清除内容(默认发出更新事件)
editor.commands.clearContent()
// 清除内容而不发出更新
editor.commands.clearContent(false)