Skip to content
/ list Public
forked from editor-js/list

Advanced List tool for the Editor.js.

License

Notifications You must be signed in to change notification settings

RobinDev/list

This branch is 1 commit ahead of, 22 commits behind editor-js/list:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7abc293 Β· Jan 5, 2025
Nov 14, 2023
Nov 18, 2024
Nov 6, 2024
Jan 5, 2025
Jun 19, 2024
Mar 7, 2021
Nov 8, 2023
Apr 19, 2022
Nov 18, 2024
Nov 6, 2024
Nov 20, 2024
Oct 5, 2024
Oct 5, 2024
Oct 23, 2024
Nov 6, 2024
Nov 6, 2024

Repository files navigation

Editorjs List Tool

  • 🀩 Part of Editor.js ecosystem.
  • πŸ“‚ Nesting.
  • πŸ”₯ Ordered and Unordered lists.
  • βœ… Checklists.
  • πŸ”’ Customizable start number.
  • πŸ›οΈ Customizable counter type (e.g. lower-roman).
  • πŸͺœ Max nesting level configuration.
  • πŸ“ Compatible with List and Checklist.

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

Installation

Get the package

yarn add @editorjs/list

Include module at your application

import EditorjsList from '@editorjs/list';

Optionally, you can load this tool from CDN JsDelivr CDN

Usage

Add the List Tool to the tools property of the Editor.js initial config.

import EditorJS from '@editorjs/editorjs';
import EditorjsList from '@editorjs/list';

var editor = EditorJS({
  // ...
  tools: {
    ...
    list: {
      class: EditorjsList,
      inlineToolbar: true,
      config: {
        defaultStyle: 'unordered'
      },
    },
  },
});

Important

Note that in List 2.0 class name changed from List to EditorjsList.

Config Params

Field Type Description
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

Output data

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:

Field Type Description
content string item's string content
meta ItemMeta meta information about item
items Item[] the array of list's items

Object ItemMeta for Checklist:

Field Type Description
checked boolean state of the checkbox

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

{
  "type" : "list",
  "data" : {
    "style": "unordered",
    "items": [
      {
        "content": "Apples",
        "meta": {},
        "items": [
          {
            "content": "Red",
            "meta": {},
            "items": []
          },
        ]
      },
    ]
  }
},

Example of the content for Ordered List

{
  "type" : "list",
  "data" : {
    "style": "ordered",
    "meta": {
      "start": 2,
      "counterType": "upper-roman",
    },
    "items" : [
      {
        "content": "Apples",
        "meta": {},
        "items": [
          {
            "content": "Red",
            "meta": {},
            "items": []
          },
        ]
      },
    ]
  }
},

Example of the content for Checklist

{
  "type" : "list",
  "data" : {
    "style": "checklist",
    "items" : [
      {
        "content": "Apples",
        "meta": {
          "checked": false
        },
        "items": [
          {
            "content": "Red",
            "meta": {
              "checked": true
            },
            "items": []
          },
        ]
      },
    ]
  }
},

About

Advanced List tool for the Editor.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 79.8%
  • CSS 8.0%
  • HTML 7.7%
  • JavaScript 4.5%