2021-04-21 17:03:33 +08:00
|
|
|
# toggleList
|
2022-06-08 18:41:14 +08:00
|
|
|
`toggleList` will toggle between different types of lists.
|
2021-04-21 17:03:33 +08:00
|
|
|
|
2022-06-08 18:41:14 +08:00
|
|
|
## Parameters
|
|
|
|
`listTypeOrName: string | NodeType`
|
|
|
|
|
|
|
|
The type of node that should be used for the wrapping list
|
|
|
|
|
|
|
|
`itemTypeOrName: string | NodeType`
|
|
|
|
|
|
|
|
The type of node that should be used for the list items
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
|
|
// toggle a bullet list with list items
|
|
|
|
editor.commands.toggleList('bullet_list', 'list_item')
|
|
|
|
|
|
|
|
// toggle a numbered list with list items
|
|
|
|
editor.commands.toggleList('ordered_list', 'list_item')
|
|
|
|
```
|