Provides Topic Blocks for the Editor.js.
Get the package
yarn add @kalebu2468/editorjs-topic
Include module at your application
import Topic from "@editorjs/editorjs-topic";
Add a new Tool to the tools
property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
topics: Topics,
},
...
});
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,
},
},
...
});
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,
},
}
}
...
});
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
}
}