JSPM

draft-js-clear-formatting

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 371
  • Score
    100M100P100Q103589F
  • License MIT

Clear all formatting helper for DraftJS

Package Exports

  • draft-js-clear-formatting

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (draft-js-clear-formatting) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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