Skip to content
forked from editor-js/list

Multi-leveled lists for the Editor.js.

License

Notifications You must be signed in to change notification settings

Ary428/nested-list

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

48a5f60 · May 8, 2024
Nov 14, 2023
Jan 23, 2023
Jul 8, 2021
Nov 29, 2023
Mar 18, 2021
Dec 18, 2022
Mar 7, 2021
Nov 8, 2023
Apr 19, 2022
Nov 9, 2023
Nov 29, 2023
Nov 8, 2023
Nov 8, 2023
Nov 8, 2023

Repository files navigation

Nested List Tool for Editor.js

Multi-leveled lists for the Editor.js.

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

Installation

Get the package

yarn add @editorjs/nested-list

Include module at your application

import NestedList from '@editorjs/nested-list';

Optionally, you can load this tool from CDN JsDelivr CDN

Usage

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

import EditorJS from '@editorjs/editorjs';
import NestedList from '@editorjs/nested-list';

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

Config Params

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

Tool's settings

You can choose list`s type.

Output data

Field Type Description
style string type of a list: ordered or unordered
items Item[] the array of list's items

Object Item:

Field Type Description
content string item's string content
items Item[] 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": []
                },
              ]
            },
        ]
    }
},

About

Multi-leveled lists for the Editor.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.5%
  • HTML 27.8%
  • CSS 9.7%