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

Background color height is incorrect on large text #61

Closed
jhchen opened this issue Nov 7, 2013 · 15 comments
Closed

Background color height is incorrect on large text #61

jhchen opened this issue Nov 7, 2013 · 15 comments

Comments

@jhchen
Copy link
Member

jhchen commented Nov 7, 2013

  1. Select a word
  2. Make the font size large
  3. Add background color

Background color does not fill the entire height. Seems to be because the span controlling the size does not expand its parent (which controls the color). Applying the formatting in reverse (color then size) does not have this issue.

@amerikan
Copy link
Contributor

amerikan commented May 8, 2014

Unless I have misunderstood the issue, the issue has been fixed (6 months old) or I am failing to follow the steps you gave correctly, I don't see this happening, at least not in Firefox 29.0/OS X.10.9.2
screen shot 2014-05-08 at 2 08 08 pm

@jhchen
Copy link
Member Author

jhchen commented May 8, 2014

You are right the step I gave works now but this is unfortunately just a side effect of some internal ordering changes. The reproduction steps are now reversed:

  1. Select word
  2. Add background color
  3. Make font size large

@amerikan
Copy link
Contributor

amerikan commented May 8, 2014

Ok now I can reproduce.

screen shot 2014-05-08 at 2 33 48 pm

@krishvs
Copy link

krishvs commented May 9, 2014

Is there any specific reason why fontsize range is being converted to pixels?

@jhchen
Copy link
Member Author

jhchen commented May 9, 2014

There could be some flexibility here. What would be your recommendation @krishvs ?

@krishvs
Copy link

krishvs commented May 10, 2014

I dont think this can be fixed using only css and the execCommand or range.As a custom undo manager exists, dom manipulation is the way to go.Have started playing around with the code and will submit a pull request if i am able to fix it.

@amerikan
Copy link
Contributor

When the font size is applied to the outer element, the background color looks as it should, however, the other way around is when the issue arises. I'm not familiar enough with coffeescript yet, but as @krishvs mentioned you'll have to manipulate the DOM to always wrap the text with the background span first and font size second.

Looks OK:

<span style="font-size: 32px;">
    <span style="background-color: rgb(255, 194, 102);">lt for the modern we</span>
</span>

Looks BAD

<span style="background-color: rgb(102, 163, 224);">
    <span style="font-size: 32px;">e case. Some built in features includ</span>
</span>

Result
screen shot 2014-05-09 at 7 08 45 pm

jhchen added a commit that referenced this issue Aug 20, 2014
@jhchen jhchen closed this as completed in b90eecd Aug 20, 2014
@jhchen
Copy link
Member Author

jhchen commented Aug 20, 2014

Still an issue for IE: ef93721

@jhchen jhchen reopened this Aug 20, 2014
@jhchen
Copy link
Member Author

jhchen commented Aug 20, 2014

Sorry had to revert this fix. Turns out it's not a good solution for other browsers either.

@EricGrange
Copy link

A possible fix is to specify "background-color: inherit" in the font-size span

@jhchen jhchen closed this as completed in 6a4c334 May 5, 2015
@jhchen
Copy link
Member Author

jhchen commented May 5, 2015

Excellent idea! Thanks!

@EricGrange
Copy link

The fix you committed only works in the editor, and not when the html is displayed afterwards.
The "background-color: inherit" should be applied alongside the font-size in the span's inline style, not in the CSS

@jhchen
Copy link
Member Author

jhchen commented May 6, 2015

What do you mean when the html is displayed afterwards? The only difference between an inline style and css style is precedence.

@EricGrange
Copy link

By afterward I mean "once it has been edited", the purpose of the editor being to edit rich text as html, this html is also meant to be displayed after its edition, without no editor in sight.

The main difference between inline & css style is not precedence, it is that inline style is part of the html, so when you display the html, inline style is guaranteed to be there, while stylesheet css is not.

It would be different if the editor was doing its editing based on css classes rather than inline styles, then having an external stylesheet to go alongside the html would be expected. But given that the editor edits inline styles, IMHO it should maintain coherent inline styles, rather than require a specific css stylesheet for the html to be displayed "as edited".

@jhchen
Copy link
Member Author

jhchen commented May 7, 2015

There are already several rules in the base Quill stylesheet that would have to be replicated to maintain visual correspondence with the editor. It's also not sufficient to just add the inherit rule to spans--it'd have to be added to all inline styles (otherwise color -> bold -> size would still trigger the bug) which is much messier markup. Fwiw Quill is moving away from inline styles by default in some future release.

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

No branches or pull requests

4 participants