1.0.2 • Published 11 months ago

@coolbytes/editorjs-quote v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Quote block tool for Editor.js

This Editor.js block tool extends @editorjs/quote to include alignment options (see Preview).

Preview

Block Tool

quote

Block Settings

settings

Installation

Using npm

npm install @coolbytes/editorjs-quote

Using yarn

yarn add @coolbytes/editorjs-quote

Usage

Include it in the tools property of Editor.js config:

const editor = new EditorJS({
  tools: {
    quote: Quote
  }
});

Config Params

FieldTypeOptionalDefaultDescription
placeholderstringYes''Placeholder text when empty
quoteStylesstring[]Yes'simple', 'block'All supported quote styles
defaultQuoteStylestringYes'simple'Preferred quote style
alignTypesstring[]Yes'left', 'center', 'right', 'justify'All supported alignment options
defaultAlignTypestringYes'left'Preferred alignment type

 

const editor = EditorJS({
  tools: {
    quote: {
      class: Quote,
      config: {
        placeholder: 'Enter quote text',
        quoteStyles: ['simple', 'block'],
        defaultQuoteStyle: 'simple'
        alignTypes: ['left', 'center', 'right', 'justify'],
        defaultAlignType: 'left'
      }
    }
  }
});

Output data

FieldTypeDescription
textstringQuote text
stylestringQuote style
alignstringAlignment type

 

Example:

{
  "time": 1715969561758,
  "blocks": [
    {
      "id": "_K5QcJHHuK",
      "type": "quote",
      "data": {
        "text": "Some quote text",
        "style": "block",
        "align": "left"
      }
    }
  ],
  "version": "2.29.1"
}
1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

1 year ago