---
title: "wrapInList 命令"
description: "在 Tiptap 中使用 wrapInList 命令将当前选择中的节点包裹在列表中。了解更多信息请查看我们的文档！"
canonical_url: "https://tiptap.zhcndoc.com/editor/api/commands/lists/wrap-in-list"
---

# wrapInList 命令

在 Tiptap 中使用 wrapInList 命令将当前选择中的节点包裹在列表中。了解更多信息请查看我们的文档！

`wrapInList` 将当前选择中的节点包裹在一个列表中。

## 参数

`typeOrName: string | NodeType`

应该包裹在列表中的节点类型。

`attributes?: Record<string, any>`

应该应用于列表的属性。**这是可选的。**

## 使用 wrapInList 命令

```js
// 将段落包裹在无序列表中
editor.commands.wrapInList('paragraph')
```
