Skip to content

germesdev/header

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/[email protected]

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
    }
}

About

Header Tool for Editor.js 2.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.4%
  • CSS 1.6%