Skip to content
Header Tool for Editor.js 2.0
Branch: master
Clone or download
Latest commit 54c7058 Mar 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Fix missing value on type changing Mar 30, 2019
src Fix missing value on type changing Mar 30, 2019
.gitignore Header Tool for CodeX Editor 2.0 Jul 27, 2018
.npmignore
LICENSE Header Tool for CodeX Editor 2.0 Jul 27, 2018
README.md Fix empty text on level changes; add more headers Mar 10, 2019
package.json Fix missing value on type changing Mar 30, 2019
webpack.config.js Feature/renaming (#15) Mar 1, 2019
yarn.lock

README.md

Header Tool

Provides Headings Blocks for the Editor.js.

Installation

Install via NPM

Get the package

npm i --save-dev @editorjs/header

Include module at your application

const Header = require('@editorjs/header');

Download to your project's source dir

  1. Upload folder dist from repository
  2. Add dist/bundle.js file to your page.

Load from CDN

You can load specific version of package from jsDelivr CDN.

https://cdn.jsdelivr.net/npm/@editorjs/header@2.0.4

Then require this script on page with Editor.js.

<script src="..."></script>

Usage

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

var editor = EditorJS({
  ...
  
  tools: {
    ...
    header: Header,
  },
  
  ...
});

Shortcut

You can insert this Block by a useful shortcut. Set it up with the tools[].shortcut property of the Editor's initial config.

var editor = EditorJS({
  ...
  
  tools: {
    ...
    header: {
      class: Header,
      shortcut: 'CMD+SHIFT+H',
    },
  },
  
  ...
});

Config Params

Field Type Description
placeholder string header's placeholder string
var editor = EditorJS({
  ...
  
  tools: {
    ...
    header: {
      class: Header,
      config: {
        placeholder: 'Enter a header'
      }
    }
  }
  
  ...
});

Tool's settings

You can select one of three levels for heading.

Output data

Field Type Description
text string header's text
level number level of header: 1 for H1, 2 for H2 ... 6 for H6
{
    "type" : "header",
    "data" : {
        "text" : "Why Telegram is the best messenger",
        "level" : 2
    }
}
You can’t perform that action at this time.