1.0.2 • Published 11 months ago

@coolbytes/editorjs-list v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

List block tool for Editor.js

This is a clone of this Editor.js nested-list block tool. It fixes the ordered list issue.

Preview

list

Installation

Using npm

npm install @coolbytes/editorjs-list

Using yarn

yarn add @coolbytes/editorjs-list

Usage

Include it in the tools property of Editor.js config:

const editor = new EditorJS({
  tools: {
    list: List
  }
});

Or init the List tool with additional settings

const editor = new EditorJS({
  tools: {
    list: {
      class: List,
      inlineToolbar: true,
      config: {
        defaultStyle: 'unordered'
      },
    },
  },
});

Config Params

FieldTypeDescription
defaultStylestringdefault list style: ordered or unordered, default is unordered

Output data

FieldTypeDescription
stylestringtype of a list: ordered or unordered
itemsItem[]the array of list's items

Object Item:

FieldTypeDescription
contentstringitem's string content
itemsItem[]the array of list's items
{
    "type" : "list",
    "data" : {
        "style" : "unordered",
        "items" : [
            {
              "content": "Apples",
              "items": [
                {
                  "content": "Red",
                  "items": []
                },
                {
                  "content": "Green",
                  "items": []
                },
              ]
            },
            {
              "content": "Bananas",
              "items": [
                {
                  "content": "Yellow",
                  "items": []
                },
              ]
            },
        ]
    }
},
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago