Allows to add an extended annotation to any text
- Editor.js v2.30+
Get the package
$ npm i editorjs-annotation
Include module at your application
import Annotation from 'editorjs-annotation';
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-annotation"></script>
- Upload folder
distfrom repository - Add
dist/bundle.jsfile to your page.
var editor = EditorJS({ // ... tools: { // ... annotation: Annotation }, // ... });
Annotation will be wrapped with a span tag. with an cdx-annotation class.
Additional data will be store in element's dataset: data-title, data-text.
{
"type" : "paragraph",
"data" : {
"text" : "Nuclear power plants have a <span class=\"cdx-annotation\" data-title=\"Carbon footprint\" data-text=\"Indicator to compare the total amount...\">carbon footprint</span>..."
}
}