Skip to content

editor-js/quote

This branch is up to date with master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

78f70cf · Dec 3, 2024
Nov 14, 2023
Dec 3, 2024
Nov 17, 2020
Nov 5, 2023
Jul 31, 2018
Nov 9, 2023
Nov 30, 2024
Dec 3, 2024
Aug 14, 2024
Aug 14, 2024
Nov 30, 2024

Repository files navigation

Quote Tool

Provides Quote Blocks for the Editor.js.

Installation

Get the package

yarn add @editorjs/quote

Include module at your application

import Quote from '@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

Field Type Description
quotePlaceholder string quote's placeholder string
captionPlaceholder string caption's placeholder string

Tool's settings

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

Output data

Field Type Description
text string quote's text
caption string caption or an author
alignment string left or center
{
    "type" : "quote",
    "data" : {
        "text" : "The unexamined life is not worth living.",
        "caption" : "Socrates",
        "alignment" : "left"
    }
}