npm.io
0.2.3 • Published 3 years ago

editorjs-codeblock

Licence
MIT
Version
0.2.3
Deps
2
Size
19 kB
Vulns
0
Weekly
0

CodeBlock Tool

Version of EditorJS that the plugin is compatible with

Provides Headings Blocks for the Editor.js.

Installation

Install via NPM

Get the package

npm i editorjs-codeblock

Include module at your application

import CodeBlock from "codeblock"

Usage

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

var editor = EditorJS({
  ...

  tools: {
    ...
    CodeBlock: CodeBlock,
  },

  ...
});

Output data

Field Type Description
code string source code in editor
{
  "type": "CodeBlock",
  "data": {
      "code": "function hello() {\n\talert('Hello world!');\n}"
  }
}

Keywords