探索 Tiptap V3 的最新功能

wrapInList 命令

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

参数

typeOrName: string | NodeType

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

attributes?: Record<string, any>

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

使用 wrapInList 命令

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