@editorjs/list

中文文档
2.0.9发布于 2025/11/13MITTypeScriptESM + CJS近 30 天下载 74.1万

List Tool for EditorJS

原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Config Params
  4. Output data
  5. Localisation
  6. Other supported keys for tools.List
  7. Example of the content for Unordered List
  8. Example of the content for Ordered List
  9. Example of the content for Checklist

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

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": []
          },
        ]
      },
    ]
  }
},

版本与发布记录

@editorjs/list 共发布 25 个版本,首次发布于 2019/03/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.9latest2025/11/131 年前
2.0.82025/05/041.5 年前
2.0.72025/05/041.5 年前
2.0.62025/02/281.7 年前
2.0.52025/02/281.7 年前
2.0.42025/01/241.8 年前

关于 @editorjs/list 的常见问题

@editorjs/list 是什么?

List Tool for EditorJS

如何安装 @editorjs/list?

在项目目录运行 npm install @editorjs/list,或使用 pnpm add / yarn add / bun add。

@editorjs/list 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@editorjs/list 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@editorjs/list 可以商用吗?

@editorjs/list 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@editorjs/list 的下载量有多少?

根据 npm 官方下载统计,@editorjs/list 在 2026/10/13 – 2026/11/11 这 30 天内被下载 740,767 次,日均约 24,692 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@editorjs/list 还在维护吗?

最新版本 2.0.9 发布于 2025/11/13(1 年前);至今共发布 25 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/03/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。