mofeiyu-editorjs-wquote

0.2.1 • Public • Published

WordQuote Tool

Provides WordQuote Blocks for the Editor.js.

Installation

Install via NPM

Get the package

npm i --save-dev @editorjs/wquote

Include module at your application

const WordQuote = require('@editorjs/wquote');

Download to your project's source dir

  1. Upload folder dist from repository
  2. Add dist/bundle.js file to your page.

Load from CDN

You can load specific version of package from jsDelivr CDN.

https://cdn.jsdelivr.net/npm/@editorjs/wquote@latest

Then require this script on page with Editor.js.

<script src="..."></script>

Usage

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

var editor = EditorJS({
  ...
  
  tools: {
    ...
    wquote: WordQuote,
  },
  
  ...
});

Or init WordQuote Tool with additional settings

var editor = EditorJS({
  ...
  
  tools: {
    ...
    wquote: {
      class: WordQuote,
      inlineToolbar: true,
      shortcut: 'CMD+SHIFT+O',
      config: {
        wquotePlaceholder: 'Enter a wquote',
        captionPlaceholder: 'WordQuote\'s author',
      },
    },
  },
  
  ...
});

Config Params

Field Type Description
wquotePlaceholder string wquote's placeholder string
captionPlaceholder string caption's placeholder string

Tool's settings

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

Output data

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

Package Sidebar

Install

npm i mofeiyu-editorjs-wquote

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

42.9 kB

Total Files

4

Last publish

Collaborators

  • nimysan