Tune for adding anchor to Editor.js Blocks
npm install editorjs-anchorshell
$ npm i editorjs-anchor
`
Include module at your application
`javascript
import AnchorTune from 'editorjs-anchor';
`
$3
You can load a specific version of the package from jsDelivr CDN.
Require this script on a page with Editor.js.
`html
`
$3
1. Upload folder dist from repository
2. Add dist/bundle.js file to your page.
Usage
$3
`javascript
var editor = EditorJS({
// ...
tools: {
// ...
anchorTune: AnchorTune
},
tunes: ['anchorTune']
// ...
});
`
$3
`javascript
var editor = EditorJS({
// ...
tools: {
// ...
anchorTune: AnchorTune,
header: {
class: Header,
tunes: ['anchorTune']
}
}
// ...
});
`
Config Params
You can add a localized string
`javascript
new Editorjs({
// ...
tools: {
anchorTune: AnchorTune
},
i18n: {
tools: {
anchorTune: {
'Anchor': 'Якорь'
}
}
},
})
`
Output data
Example for Header block
`json
{
"type": "header",
"data": {
"text": "Header",
"level": 2
},
"tunes": {
"anchorTune": {
"anchor": "header-anchor"
}
}
}
``