Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including codex.editor.quote with all npm packages installed. Try it out:

var codexEditorQuote = require("codex.editor.quote")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

codex.editor.quote v2.1.5

Quote Tool for CodeX.Editor

Quote Tool

Provides Quote Blocks for the CodeX Editor.

Installation

Install via NPM

Get the package

npm i --save-dev codex.editor.quote

Include module at your application

const Quote = require('codex.editor.quote');

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/codex.editor.quote@2.0.0

Then require this script on page with CodeX Editor.

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

Usage

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

var editor = CodexEditor({
  ...
  
  tools: {
    ...
    quote: Quote,
  },
  
  ...
});

Or init Quote Tool with additional settings

var editor = CodexEditor({
  ...
  
  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

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 or center
{
    "type" : "quote",
    "data" : {
        "text" : "The unexamined life is not worth living.",
        "caption" : "Socrates",
        "alignment" : "left"
    }
}

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free