Skip to content
/ header Public
forked from editor-js/header

Header Tool for Editor.js 2.0

License

Notifications You must be signed in to change notification settings

gavro/header

This branch is up to date with editor-js/header:master.

Folders and files

NameName
Last commit message
Last commit date
Jul 3, 2024
Oct 9, 2024
Nov 17, 2020
Nov 5, 2023
Jul 27, 2018
Nov 9, 2023
Oct 9, 2024
Jun 13, 2024
Jun 14, 2024
Jun 13, 2024

Repository files navigation

Heading Tool

Version of EditorJS that the plugin is compatible with

Provides Headings Blocks for the Editor.js.

Installation

Get the package

yarn add @editorjs/header

Include module at your application

import Header from '@editorjs/header';

Optionally, you can load this tool from CDN JsDelivr CDN

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

All properties are optional.

Field Type Description
placeholder string header's placeholder string
levels number[] enabled heading levels
defaultLevel number default heading level
var editor = EditorJS({
  ...

  tools: {
    ...
    header: {
      class: Header,
      config: {
        placeholder: 'Enter a header',
        levels: [2, 3, 4],
        defaultLevel: 3
      }
    }
  }

  ...
});

Tool's settings

An image showing the header block tool

You can select one of six 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

  • TypeScript 92.7%
  • JavaScript 5.1%
  • CSS 2.2%