1.0.4 • Published 4 years ago
draft-js-import-html-patched v1.0.4
DraftJS: Patched Import HTML to ContentState
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