Basic clear formatting tool for Editor.js.
Get the package
npm i @ympact.dev/editorjs-clear-formatting
Include module at your application
import ClearFormatting from '@ympact.dev/editorjs-clear-formatting';
Add a new Tool to the tools
property of the Editor. The clear formatting will be included in the inline toolbar of all block tools in case the inlineToolbar
setting of the block tool is not set. To explicitly include it in a block tool use : inlineToolbar: ['clearFormatting']
var editor = new EditorJS({
...
tools: {
...
clearFormatting:{
class: ClearFormatting
config: {
shortcut: null,
closeOnClick: false,
icon: `<svg>...</svg>`
}
},
}
...
});
The clear formatting tool does not output any data. It clears all existing formatting within the selection.
- Simple clearing of formatting within selection
- Keep track of newly inserted formatting from other tools while inline toolbar is visible for selection
- More advanced clearing using boundaries