Skip to content

editor-js/header

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

importHeaderfrom'@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.

vareditor=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.

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

Config Params

All properties are optional.

FieldTypeDescription
placeholderstringheader's placeholder string
levelsnumber[]enabled heading levels
defaultLevelnumberdefault heading level
vareditor=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

FieldTypeDescription
textstringheader's text
levelnumberlevel 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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 15