Skip to content

Commit

Permalink
Merge pull request #109 from editor-js/improve-item-meta
Browse files Browse the repository at this point in the history
Imp (types): Improved types for List data and it's meta
  • Loading branch information
e11sy authored Nov 6, 2024
2 parents c0cb8ee + 84dc345 commit d92ff75
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 470 deletions.
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

# Editorjs List Tool

Multi-leveled lists for the [Editor.js](https://editorjs.io).

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.
Expand All @@ -19,6 +11,11 @@ Use `Tab` and `Shift+Tab` keys to create or remove sublist with a padding.
- 🪜 Max nesting level configuration.
- 📝 Compatible with [List](https://github.com/editor-js/list) and [Checklist](https://github.com/editor-js/checklist).


![](assets/example.gif)

Use `Tab` and `Shift+Tab` keys to create or remove sublist with a padding.

## Installation

Get the package
Expand Down Expand Up @@ -67,12 +64,11 @@ var editor = EditorJS({

## Output data

| 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` |
| Field | Type | Description |
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| style | `string` | list will be rendered with this style: `ordered`, `unordered` or `checklist`, default is `defaultStyle` from tool config |
| meta | `ItemMeta`| Item meta based on the list style |
| items | `Item[]` | the array of list's items |

Object `Item`:

Expand All @@ -88,7 +84,15 @@ Object `ItemMeta` for Checklist:
| ------- | --------- | ------------------------- |
| checked | `boolean` | state of the checkbox |

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

| Field | Type | Description |
| ------- | --------- | ------------------------- |
| start | `number` | number for list to start with, default is 1 |
| counterType | `string` | counter type for list, it could be `numeric`, `lower-roman`, `upper-roman`, `lower-alpha`, `upper-alpha`, default is `numeric` |


Object `ItemMeta` for Unordered list would be empty.


## Example of the content for `Unordered List`
Expand Down Expand Up @@ -120,8 +124,10 @@ Object `ItemMeta` for Ordered and Unordered lists would be empty.
"type" : "list",
"data" : {
"style": "ordered",
"start": 2,
"counterType": "upper-roman",
"meta": {
"start": 2,
"counterType": "upper-roman",
},
"items" : [
{
"content": "Apples",
Expand Down
Loading

0 comments on commit d92ff75

Please sign in to comment.