Inline tool for underlining text fragments for the Editor.js
Get the package
npm i --save @editorjs/underline
yarn add @editorjs/underline
Include module at your application
import Underline from '@editorjs/underline';
- Upload folder
dist
from repository - Add
dist/bundle.js
file to your page.
You can load the package from jsDelivr CDN and require the script on a page with Editor.js.
<script src="https://cdn.jsdelivr.net/npm/@editorjs/underline@latest"></script>
Add a new Tool to the tools
property of the Editor.js initial config.
import EditorJs from '@editorjs/editorjs';
import Underline from '@editorjs/underline';
var editor = new EditorJS({
// ...
tools: {
// ...
underline: Underline
},
});
This Tool has no config params
Underlined text will be wrapped with a u
tag with an cdx-underline
class.
{
"type" : "text",
"data" : {
"text" : "Create a directory for your module, enter it and run <u class=\"cdx-underline\">npm init</u> command."
}
}