Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore (readme): Updated readme #101

Merged
merged 9 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 101 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ Use `Tab` and `Shift+Tab` keys to create or remove sublist with a padding.

![](assets/example.gif)

## Features

- 🤩 Part of [Editor.js](https://editorjs.io/) ecosystem.
- 📂 Nesting.
- 🔥 Ordered and Unordered lists.
- ✅ Checklists.
- 🔢 Customizable start number.
- 🏛️ Customizable counter type (e.g. `lower-roman`).
- 🪜 Max nesting level configuration.
- 📝 Compatible with [List](https://github.com/editor-js/list) and [Checklist](https://github.com/editor-js/checklist).

## Installation

Get the package
Expand Down Expand Up @@ -51,58 +62,109 @@ var editor = EditorJS({

| Field | Type | Description |
|--------------|----------|----------------------------------------------------------------|
| defaultStyle | `string` | default list style: `ordered` or `unordered`, default is `unordered` |

## Tool's settings
| defaultStyle | `string` | default list style: `ordered`, `unordered` or `checklist`, default is `unordered` |
| maxLevel | `number` | maximum level of the list nesting, could be set to `1` to disable nesting, unlimited by default |

![](assets/bf5a42e4-1350-499d-a728-493b0fcaeda4.jpg)
## Default Output data

You can choose list`s type.
| Field | Type | Description | List type |
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| style | `string` | list will be rendered with this style: `ordered`, `unordered` or `checklist`, default is `defaultStyle` from tool config | `ordered`, `unordered`, `checklist` |
| start | `number` | list will start with this number, default is `1` | `ordered` |
| counterType | `number` | type of the counters: `numeric`, `lower-roman`, `upper-roman`, `lower-alpha`, `upper-alpha`, default is `numeric` | `ordered` |
| items | `Item[]` | the array of list's items | `ordered`, `unordered`, `checklist` |

## Output data
Object `Item`:

| Field | Type | Description |
| ----- | --------- | ---------------------------------------- |
| style | `string` | type of a list: `ordered` or `unordered` |
| items | `Item[]` | the array of list's items |
| Field | Type | Description |
| ------- | ---------- | --------------------------- |
| content | `string` | item's string content |
| meta | `ItemMeta` | meta information about item |
| items | `Item[]` | the array of list's items |

Object `Item`:
Object `ItemMeta` for Checklist:

| Field | Type | Description |
| ------- | --------- | ------------------------- |
| content | `string` | item's string content |
| items | `Item[]` | the array of list's items |
| checked | `boolean` | state of the checkbox |

Object `ItemMeta` for Ordered and Unordered lists would be empty.


## Example of the content for `Unordered List`
```json
{
"type" : "list",
"data" : {
"style" : "unordered",
"items" : [
{
"content": "Apples",
"items": [
{
"content": "Red",
"items": []
},
{
"content": "Green",
"items": []
},
]
},
{
"content": "Bananas",
"items": [
{
"content": "Yellow",
"items": []
},
]
"type" : "list",
"data" : {
"style": "unordered",
"maxLevel": 1,
"items": [
{
"content": "Apples",
"meta": {},
"items": [
{
"content": "Red",
"meta": {},
"items": []
},
]
},
]
}
},
```

## Example of the content for `Ordered List`
```json
{
"type" : "list",
"data" : {
"style": "ordered",
"start": 2,
"counterType": "upper-roman",
"maxLevel": 4,
"items" : [
{
"content": "Apples",
"meta": {},
"items": [
{
"content": "Red",
"meta": {},
"items": []
},
]
},
]
}
},
```

## Example of the content for `Checklist`
```json
{
"type" : "list",
"data" : {
"style": "checklist",
"maxLevel": 4,
"items" : [
{
"content": "Apples",
"meta": {
"checked": false
},
"items": [
{
"content": "Red",
"meta": {
"checked": true
},
"items": []
},
]
}
},
]
}
},
```
Binary file removed assets/bf5a42e4-1350-499d-a728-493b0fcaeda4.jpg
Binary file not shown.
19 changes: 19 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,25 @@
],
},
},
{
type: 'checklist',
data: {
items: [
{
text: "This is a block-styled editor",
checked: true
},
{
text: "Clean output data",
checked: false
},
{
text: "Simple and powerful API",
checked: true
}
]
}
}
],
},
onReady: function(){
Expand Down
Loading