Paragraph block tool for Editor.js
npm install @coolbytes/editorjs-paragraphThis Editor.js block tool extends @editorjs/paragraph to include alignment options (see Preview).
#### Block Tool
!paragraph
#### Block Settings
!settings
Using npm
``sh`
npm install @coolbytes/editorjs-paragraph
Using yarn
`sh`
yarn add @coolbytes/editorjs-paragraph
Include it in the tools property of Editor.js config:
`js`
const editor = new EditorJS({
tools: {
paragraph: Paragraph
}
});
|Field|Type|Optional|Default|Description|
|---|---|---|---|---|
|placeholder|string|Yes|''|Placeholder text when empty|boolean
|preserveBlank||Yes|false|Indicates whether to include blank paragraphs when saving editor data|string[]
|alignTypes||Yes|['left', 'center', 'right', 'justify']|All supported alignment options|string
|defaultAlignType||Yes|'left'|Preferred alignment type|
`js`
const editor = EditorJS({
tools: {
paragraph: {
class: Paragraph,
config: {
placeholder: 'Start Typing...',
preserveBlank: false,
alignTypes: ['left', 'center', 'right', 'justify'],
defaultAlignType: 'left'
}
}
}
});
|Field|Type|Description|
|---|---|---|
|text|string|Paragraph's text|string
|align||Alignment type|
Example:
`json``
{
"time": 1715969561758,
"blocks": [
{
"id": "_K5QcJHHuK",
"type": "paragraph",
"data": {
"text": "Cool Bytes",
"align": "center"
}
}
],
"version": "2.29.1"
}