toggleList 命令
toggleList 将在不同类型的列表之间切换。
参数
listTypeOrName: string | NodeType
应用于包装列表的节点类型
itemTypeOrName: string | NodeType
应用于列表项的节点类型
keepMarks?: boolean
是否应将标记保留为列表项
attributes?: Record<string, any>
应应用于列表的属性。这是可选的。
使用 toggleList 命令
// 切换带列表项的项目符号列表
editor.commands.toggleList('bulletList', 'listItem')
// 切换带列表项的编号列表
editor.commands.toggleList('orderedList', 'listItem')