Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning multiple styles from customInlineFn? #154

Open
betancourtl opened this issue Dec 22, 2018 · 2 comments
Open

Returning multiple styles from customInlineFn? #154

betancourtl opened this issue Dec 22, 2018 · 2 comments

Comments

@betancourtl
Copy link

betancourtl commented Dec 22, 2018

Hi thank you for creating this awesome library!

I am working on fixing an issue on one of my draft-js repos:

betancourtl/draft-js-custom-styles#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?

let customInline = customInlineFn ? customInlineFn(element, this.inlineCreators) : null;
if (customInline != null) {
switch (customInline.type) {
case 'STYLE': {
style = style.add(customInline.style);
break;
}
case 'ENTITY': {
entityKey = customInline.entityKey;
break;
}
}
} else {

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:

screenshot 2018-12-21 20 53 28

@mitchellwarr
Copy link

Its been months, can we please get an update on this

@coding-watermelon
Copy link

There already is an open PR for this.
#155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants