2.0.8 • Published 5 months ago

@editorjs/list v2.0.8

Weekly downloads
10,145
License
MIT
Repository
github
Last release
5 months ago

npm.io

Editorjs List Tool

npm.io

  • 🤩 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.

npm.io

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

FieldTypeDescription
defaultStylestringdefault list style: ordered, unordered or checklist, default is unordered
maxLevelnumbermaximum level of the list nesting, could be set to 1 to disable nesting, unlimited by default
counterTypesstring[]specifies which counter types should be shown in the ordered list style, could be set to ['numeric','upper-roman'], default is undefined which shows all counter types

Output data

FieldTypeDescription
stylestringlist will be rendered with this style: ordered, unordered or checklist, default is defaultStyle from tool config
metaItemMetaItem meta based on the list style
itemsItem[]the array of list's items

Object Item:

FieldTypeDescription
contentstringitem's string content
metaItemMetameta information about item
itemsItem[]the array of list's items

Object ItemMeta for Checklist:

FieldTypeDescription
checkedbooleanstate of the checkbox

Object ItemMeta for Ordered list

FieldTypeDescription
startnumbernumber for list to start with, default is 1
counterTypestringcounter 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.

Localisation

If you want to use your language for toolbox items, you can pass i18n dictionary to the editorjs instance below the tools block:

i18n: { 
  messages: {
    "toolNames": {
      "Ordered List": "Nummerierte Liste",
      "Unordered List": "Unnummeriert Liste",
      "Checklist": "Checkliste",
    },
    "tools": {
      "List": {
        'Unordered': 'Unnummeriert',
        'Ordered': 'Nummerierte',
        'Checklist': 'Checkliste',
      }
    },
  },
},

Other supported keys for tools.List

  • Start with
  • Counter type
  • Numeric
  • Lower Roman
  • Upper Roman
  • Lower Alpha
  • Upper Alpha

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": []
          },
        ]
      },
    ]
  }
},
@polo7/block-editorbyevolutioncytoscape.stickynote@infinitebrahmanuniverse/nolb-_edi@everything-registry/sub-chunk-277aalda-editorstrapi-plugin-editorstrapi-plugin-editorjsstrapi-plugin-editorjs-fieldstrapi-plugin-editorjs-nextstrapi-plugin-k-editorjsstrapi-academy-plus-editorjsstrapi-editorjsvue-editorjs-adapter@creators-view/fluid-ui@cromwell/admin-panel@core-edu/ui@caliobase/caliobase-ui@canburaks/fibs-editor@rulab/adminjs-componentsisha-rte-editorblockeditor-test@om-mediaworks/shacl-formstd-pagestrapi-plugin-react-editorjsstrapi-plugin-react-editorjs-extended-embedsrinstallersui-duckumomega-foundation@appconda/console-sdk@appconda/react@appconda/react-sdk@appconda/sdk@appconda/web-sdk@bigbossstudio/strapi-plugin-editorjs@celmino/sdk@celmino/sdk-console@centrepointmedia/synoraui@acf-int/strapi-plugin-react-editorjs@juancamejoalarcon/templator@brandontle/react-editor.js@ddoctors.ru/editorjs@ddoctors/editor@dicarbene/nuxt3-editorjs@datahu/client@datahu/component@datahu/designeryt-editoruse-editor-js@highoutput/neyar@fireenjin/editor@emilienkopp/ejs-factory@emilienkopp/html-factory@evershop/evershop@laodeaksarr/rte@lotsof/carpenter@lotsof/json-schema-form@itandu/admin-panel@madnesslabs/enjin-editor@fakel/rest-admin@mockswitch/cli@matthewkilpatrick/strapi-plugin-editor-js@keystonejs-contrib/fields-editorjs@hyype-inc/widget@dxbz/gs-t-components@kaniyarasu/react-editor.js@offlegacy/react-editorjs@rainyland-dev/strapi-plugin-editorjs@rypock/react-frontend@questflow/canvas@realmocean/editor@realmocean/sdk@rjgf/rj-components@nwire/amit-design-system@oak-digital/strapi-plugin-react-editorjs@ossph/temple-uimtxtrpcv2murph-projectnuxt-editorjssarman-vue-editor-jsreact-editor-simple-image.jsreact-editor-simple-imagenext-step-projectpn-block-editorquickvue-editorjssmart-editorsofa-ui-componentsgp-editorjsilla-buildergs-text-editorhorul-editorhsl-strapi-plugin-react-editorjslike-waterlrl-cms-tapirmagnermemories-uimedusa-plugin-editorjs@wisdech/react-editor@vt7/vue-editor@wulperstudio/wulper-studio-editor
2.0.3

9 months ago

2.0.2

11 months ago

2.0.5

7 months ago

2.0.4

9 months ago

2.0.7

5 months ago

2.0.6

7 months ago

2.0.8

5 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.10.0

1 year ago

1.9.0

2 years ago

1.8.0

3 years ago

1.7.0

4 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

6 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago