List block tool for Editor.js
npm install @coolbytes/editorjs-listThis is a clone of this Editor.js nested-list block tool. It fixes the ordered list issue.
!list
Using npm
``sh`
npm install @coolbytes/editorjs-list
Using yarn
`sh`
yarn add @coolbytes/editorjs-list
Include it in the tools property of Editor.js config:
`js`
const editor = new EditorJS({
tools: {
list: List
}
});
Or init the List tool with additional settings
`javascript`
const editor = new EditorJS({
tools: {
list: {
class: List,
inlineToolbar: true,
config: {
defaultStyle: 'unordered'
},
},
},
});
| Field | Type | Description |
|--------------|----------|----------------------------------------------------------------|
| defaultStyle | string | default list style: ordered or unordered, default is unordered |
| Field | Type | Description |
| ----- | --------- | ---------------------------------------- |
| style | string | type of a list: ordered or unordered |Item[]
| items | | the array of list's items |
Object Item:
| Field | Type | Description |
| ------- | --------- | ------------------------- |
| content | string | item's string content |Item[]
| items | | the array of list's items |
`json``
{
"type" : "list",
"data" : {
"style" : "unordered",
"items" : [
{
"content": "Apples",
"items": [
{
"content": "Red",
"items": []
},
{
"content": "Green",
"items": []
},
]
},
{
"content": "Bananas",
"items": [
{
"content": "Yellow",
"items": []
},
]
},
]
}
},