Skip to content
On this page

Paragraph

Basic text tool with alignment (left, center, right, and justify)

Usage

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

js
import { Paragraph } from "@ageesea/text-toolkit"

let editor = EditorJS({
  ...

  tools: {
    ...
    paragraph: {
      class: Paragraph,
      inlineToolbar: true,
    },
  }

  ...
});

Config Params

The Paragraph Tool supports these configuration parameters:

FieldTypeDescription
placeholderstringThe placeholder. Will be shown only in the first paragraph when the whole editor is empty.
preserveBlankboolean(default: false) Whether or not to keep blank paragraphs when saving editor data
defaultAlignmentstring(default: left) The default alignment

Output Data

FieldTypeDescription
textstringparagraph's text
alignmentstringtext alignment (left, center, right, and justify)
json
{
  "type" : "paragraph",
  "data" : {
    "text" : "Follow me @anthonygacis",
    "alignment": "center"
  }
}

Released under the MIT License