0.0.17 • Published 30 days ago
@kalebu2468/editorjs-topic v0.0.17
Topic Tool
Provides Topic Blocks for the Editor.js.
Installation
Get the package
yarn add @kalebu2468/editorjs-topic
Include module at your application
import Topic from "@editorjs/editorjs-topic";
Usage
Add a new Tool to the tools
property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
topics: Topics,
},
...
});
Shortcut
You can insert this Block by a useful shortcut. Set it up with the tools[].shortcut
property of the Editor's initial config.
var editor = EditorJS({
...
tools: {
...
topics: {
class: Topics,
},
},
...
});
Config Params
All properties are optional.
Field | Type | Description |
---|---|---|
placeholder | string | topic's placeholder string |
levels | number[] | enabled topic levels |
defaultLevel | number | default topic level |
var editor = EditorJS({
...
tools: {
...
topics: {
class: Topics,
config: {
placeholder: "Enter a Topic",
levels: [1],
defaultLevel: 1,
},
}
}
...
});
Output data
Field | Type | Description |
---|---|---|
text | string | topic's text |
level | number | level of topic |
{
"type": "topic",
"data": {
"text": "Why Telegram is the best messenger",
"level": 1
}
}