1.0.5 • Published 5 months ago

@juratbek/editorjs-quote v1.0.5

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

npm.io

Quote Tool

Provides Quote Blocks for the Editor.js.

npm.io

Installation

Get the package

npm i @juratbek/editorjs-quote
yarn add @juratbek/editorjs-quote

Include module at your application

import Quote from "@juratbek/editorjs-quote";

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.

var editor = EditorJS({
  ...

  tools: {
    ...
    quote: Quote,
  },

  ...
});

Or init Quote Tool with additional settings

var editor = EditorJS({
  ...

  tools: {
    ...
    quote: {
      class: Quote,
      inlineToolbar: true,
      shortcut: 'CMD+SHIFT+O',
      config: {
        quotePlaceholder: 'Enter a quote',
        captionPlaceholder: 'Quote\'s author',
      },
    },
  },

  ...
});

Config Params

FieldTypeDescription
quotePlaceholderstringquote's placeholder string
captionPlaceholderstringcaption's placeholder string

Tool's settings

npm.io

You can choose alignment for the quote. It takes no effect while editing, but saved the «alignment» param.

Output data

FieldTypeDescription
textstringquote's text
captionstringcaption or an author
alignmentstringleft, right or center
{
  "type": "quote",
  "data": {
    "text": "The unexamined life is not worth living.",
    "caption": "Socrates",
    "alignment": "left"
  }
}
1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago