tiptap wrapInList
功能
wrapInList
会在当前选区中包裹一个节点到一个列表中。
参数
typeOrName: string | NodeType
包裹的节点类型,可以是字符串(如
"paragraph"
)或节点类型对象。attributes?: Record<string, any>
应该应用到列表上的属性。这是可选的。
使用示例
// 将段落包裹到项目符号列表中
editor.commands.wrapInList("paragraph");
请注意,这个命令会根据传入的参数创建相应的列表(如无序列表或有序列表),并设置指定的属性。如果不需要添加属性,可以省略 attributes
参数。