1.1.0 • Published 8 months ago
editorjs-spoiler v1.1.0
Spoiler Block Tool for Editor.js
Ability to add a spoiler block with a title.
Preview
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
- Upload folder
dist
from repository - 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 |