---
title: "clearContent 命令"
description: "使用 Tiptap 编辑器中的 clearContent 命令删除编辑器中的所有内容。了解更多信息，请查看文档。"
canonical_url: "https://tiptap.zhcndoc.com/editor/api/commands/content/clear-content"
---

# clearContent 命令

使用 Tiptap 编辑器中的 clearContent 命令删除编辑器中的所有内容。了解更多信息，请查看文档。

`clearContent` 命令用于删除当前文档。编辑器将保持至少一个空段落，以满足架构要求。

另见：[setContent](https://tiptap.zhcndoc.com/editor/api/commands/content/set-content.md)、[insertContent](https://tiptap.zhcndoc.com/editor/api/commands/content/insert-content.md)

## 参数

`emitUpdate?: boolean (true)`
是否发出更新事件。默认为 `true`（注意：在 v2 中从 `false` 更改为此）。

## 示例

```js
// 清除内容（默认发出更新事件）
editor.commands.clearContent()

// 清除内容而不发出更新
editor.commands.clearContent(false)
```
