1.1.0 • Published 10 months ago

editorjs-spoiler v1.1.0

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

Spoiler Block Tool for Editor.js

Ability to add a spoiler block with a title.

Preview

Preview image

Installation

Install via NPM

Get the package

$ npm i editorjs-spoiler

Include module at your application

import Spoiler from 'editorjs-spoiler';

Load from CDN

You can load a specific version of the package from jsDelivr CDN.

Require this script on a page with Editor.js.

<script src="https://cdn.jsdelivr.net/npm/editorjs-spoiler"></script>

Download to your project's source dir

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

Usage

const editor = EditorJS({
  // ...
  tools: {
    // ...
    spoiler: {
      class: Spoiler,
      config: {
        editorLibrary: EditorJS,
        editorTools: {
          header: {
            class: Header,
            inlineToolbar: false,
            config: {
              placeholder: 'Header'
            }
          },
          checklist: Checklist,
          delimiter: Delimiter,
          // ...
        }
      }
    },
  }
  // ...
});

Config Params

FieldTypeDescription
editorLibraryobjectEditorJS library
editorToolsobject[]Configuration of editor blocks to be available in spoiler
editorTunesobject[]Configuration of editor block tunes to be available in spoiler

Output data

This Tool returns data with following format

FieldTypeDescription
caprionstringSpoiler caption
contentobjectSaved EditorJS data in spoiler
1.1.0

10 months ago

1.0.1

10 months ago