Skip to content

VolgaIgor/editorjs-spoiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Field Type Description
editorLibrary object EditorJS library
editorTools object[] Configuration of editor blocks to be available in spoiler
editorTunes object[] Configuration of editor block tunes to be available in spoiler

Output data

This Tool returns data with following format

Field Type Description
caprion string Spoiler caption
content object Saved EditorJS data in spoiler