draft-js-clear-formatting
v1.0.0
Published
Clear all formatting helper for DraftJS
Downloads
2,445
Maintainers
Readme
Draft.js Clear Formatting
This package is a helper function for Draft JS users. It allows you toclear formatting in selected text in your app. You can choose to remove the following edits:
- Inline styles(bold, italic, underline)
- Entities(images, links etc.)
- Lists(orders, unorderes)
For more details checks configuration section below
Usage
npm i --save draft-js-clear-formatting
then import the function
import clearFormatting from 'draft-js-clear-formatting'
import Editor from 'draft-js-plugins-editor'
const newEditorState = clearFormatting(editorState, options)
Options object
You can pass options object to the function. This object is not required. By default all options set to true.
const options = {
inline: true,
entities: true,
lists: true,
}
| Option | Description | Default value | | -------- | ------------------------- | ------------- | | inline | Removes all inline styles | true | | entities | Removes all entities | true | | lists | Removes all lists | true |
TO DO
- [ ] Add tests