1.1.0 • Published 1 year ago

@clefermy/editorjs-spoiler v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm.io

spoiler Tool

Inline tool for hiding text fragments for the Editor.js

Installation

Install via NPM

Get the package

npm i --save @clefermy/editorjs-spoiler
yarn add @clefermy/editorjs-spoiler

Include module at your application

import spoiler from '@clefermy/editorjs-spoiler';

Download to your project's source dir

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

Usage

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

import EditorJs from '@clefermy/editorjs';
import spoiler from '@clefermy/editorjs-spoiler';

var editor = new EditorJS({
  // ...
  tools: {
    // ...
    spoiler: spoiler
  },
});

Config Params

This Tool has no config params

Output data

spoilerd text will be wrapped with a span tag with an cdx-spoiler class.

{
    "type" : "text",
    "data" : {
        "text" : "Create a directory for your module, enter it and run <span class=\"cdx-spoiler\">npm init</span> command."
    }
}