@editorjs/footnotes

中文文档
1.1.0发布于 2021/08/25MITTypeScriptCommonJS近 30 天下载 2114

Footnotes Block Tune for Editor.js

原始使用文档
文档目录7 节
  1. Installation
  2. Install via NPM or Yarn
  3. Load from CDN
  4. Build from source code
  5. Usage
  6. Config Params
  7. Output data

Footnotes Tune

Footnotes Block Tune for the Editor.js.

☝️ Because of FireFox bug Tune doesn't work well there.

Installation

Install via NPM or Yarn

Get the package

npm i --save-dev @editorjs/footnotes

or

yarn add @editorjs/footnotes --dev

Include module in your application

const FootnotesTune = require('@editorjs/footnotes');

Load from CDN

Load the script from jsDelivr CDN and connect to your page.

Build from source code

  1. Clone the repo
  2. Run yarn to install dependencies
  3. Run yarn build to build the package
  4. Add dist/bundle.js file to your page.

Usage

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

var editor = EditorJS({
  ...
  
  tools: {
    ...
    footnotes: {
      class: FootnotesTune,
    }
  }
  
  ...
});

To enable Footnotes Tune for other blocks, just add a tunes property to their configuration:

var editor = EditorJS({
  ...
  
  tools: {
    list: {
      class: ListTool,
      tunes: ['footnotes'], // note that stirng here should be the same as tools object key for Tune  
    },
    paragraph: {
      tunes: ['footnotes'], // note that stirng here should be the same as tools object key for Tune  
    },
    footnotes: {
      class: FootnotesTune,
    }
  }
  
  ...
});

You can pass additional configuration for the Tune

var editor = EditorJS({
  ...
  
  tools: {
    ...
    footnotes: {
      class: FootnotesTune,
      config: {
        placeholder: 'Your placeholder for footnotes popover',
        shortcut: 'CMD+SHIFT+F',
      },
    },
  },
  
  ...
});

Config Params

FieldTypeDescription
placeholderstringplaceholder for empty footnote popover
shortcutstringshortcut to insert Footnote element

Output data

This tune inserts sup elements to Block's content with data-tune="footnotes" attribute so you can find them on render.

Also, on Block save you'll get tunes property inside saved data with footnotes property (the same as the key in the initial configuration).

tune.footnotes property contains array of strings respectively to each sup element in Block's content

{
  "type": "paragraph",
  "data": {
    "text": "You text with a footnote<sup data-tune=\"footnotes\">1</sup>. And another footnote<sup data-tune=\"footnotes\">2</sup>"
  },
  "tunes": {
    "footnotes": [
      "This is a text for the first footnote",
      "And text for the second one"
    ]
  }
}

Support maintenance 🎖

If you're using this tool and editor.js in your business, please consider supporting their maintenance and evolution.

http://opencollective.com/editorjs

About CodeX

CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are open for young people who want to constantly improve their skills and grow professionally with experiments in leading technologies.

🌐Join 👋TwitterInstagram
codex.socodex.so/join@codex_team@codex_team

版本与发布记录

@editorjs/footnotes 共发布 2 个版本,首次发布于 2021/07/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2021/08/255 年前
1.0.02021/07/225 年前

关于 @editorjs/footnotes 的常见问题

@editorjs/footnotes 是什么?

Footnotes Block Tune for Editor.js

如何安装 @editorjs/footnotes?

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

@editorjs/footnotes 支持 TypeScript 吗?

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

@editorjs/footnotes 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@editorjs/footnotes 可以商用吗?

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

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

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

@editorjs/footnotes 还在维护吗?

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