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

Add support for multiple custom styles, separated by a space #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

js-seo
Copy link

@js-seo js-seo commented Apr 4, 2018

When you do this,

stateFromHTML(htmlContent, {
  customInlineFn: (element, { Style, Entity }) => {
    const { color, fontSize } = element.style
    return Style(`color${color} fontSize${fontSize} FOO BAR`)
  },
})

now each inline element has overlapping four styles.

@RTeran
Copy link

RTeran commented Apr 23, 2018

+1

@VictorParraCant
Copy link

@sstur Why has not this solution been implemented yet? I would like to be able to use it without changing my node_modules. Review please

@ururekina
Copy link

@VictorParraCant @sstur +1

Copy link

@preetriti preetriti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another way to do this with lesser changes.
In line: 344 just use style.union(customInline.styles)

Now the Style in inlineCreators should be changed from string -> string[].
This way it removes the condition that styles should be separated with ' '. The code can be agnostic to that.

@khalska
Copy link

khalska commented Jul 16, 2018

It doesn't work with rgb colours because split find spaces in colours - rgb(255, 120, 0).

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

Successfully merging this pull request may close these issues.

7 participants