draft-js-utils
draft-js-utils copied to clipboard
Returning multiple styles from customInlineFn?
Hi thank you for creating this awesome library!
I am working on fixing an issue on one of my draft-js repos:
https://github.com/webdeveloperpr/draft-js-custom-styles/issues/2
I basically need to use the customStyleFn to return an array of styles to be applied to an element. As of now you can only return 1 style. Would it be possible to make a change that could return an array of styles from the customStyle fn?
https://github.com/sstur/draft-js-utils/blob/c3d6145a13897f9ff7eed2f3a393756f3043c310/packages/draft-js-import-element/src/stateFromElement.js#L340-L352
I need line something like this:
var customInline = customInlineFn ? customInlineFn(element, this.inlineCreators) : null;
if (customInline != null) {
switch (customInline.type) {
case 'STYLE':
{
// Adds strings or arrays as styles.
[].concat(customInline.style).forEach(x => style = style.add(x));
break;
}
Here are the correct styles:
Its been months, can we please get an update on this
There already is an open PR for this. https://github.com/sstur/draft-js-utils/pull/155