1.0.4 • Published 4 years ago

draft-js-import-html-patched v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

DraftJS: Patched Import HTML to ContentState npm version

This is improved version of draft-js-import-html with patched draft-js-import-element

Patches

  • More than one style support in customInlineFn function by passing array
const options = {
  customInlineFn: (element, { Style, Entity }) => {
    if (element.tagName === 'SPAN' && element.className === 'italicAndBold') {
      return Style(['ITALIC', 'BOLD'])
    }
  }
}
  • Keep default entities when custom styles provided in customInlineFn
const options = {
  customInlineFn: (element, { Style, Entity }) => {
    if (element.tagName === 'A') {
      return Style('ITALIC') // LINK entity will still be created after custom style providing
    }
  }
}

Installation

yarn add draft-js-import-html-patched
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago