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

Inline styles in paragraph when setting custom sizes in the editor #7765

Closed
samikeijonen opened this issue Jul 7, 2018 · 6 comments
Closed
Labels
[Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.

Comments

@samikeijonen
Copy link
Contributor

samikeijonen commented Jul 7, 2018

Describe the bug
I still see this inline styles when adding Custom Size to paragraph in the editor.

To Reproduce

  • Add new paragraph block.
  • Set Custom Size to L.
  • It adds inline style style="font-size: 36px;".

Expected behavior
What it should do is add class is-large-text so that it would respect what theme wants.

In Core block these happens to be the same font sizes:)

p {
	&.is-small-text {
		font-size: 14px;
	}

	&.is-regular-text {
		font-size: 16px;
	}

	&.is-large-text {
		font-size: 36px;
	}

	&.is-larger-text {
		font-size: 48px;
	}
}

cc: @mtias @jasmussen

@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks labels Jul 18, 2018
@designsimply
Copy link
Member

I just tested with WordPress 4.9.7 and Gutenberg 3.2.0 and I found that if I add some text to a paragraph block and set the font size to "L" that this is the resulting markup:

<p class="is-large-text">hello, world</p>

screen shot 2018-07-18 at wed jul 18 3 17 11 pm
Seen at http://alittletestblog.com/wp-admin/post.php?post=14014&action=edit running WordPress 4.9.7 and Gutenberg 3.2.0 using Firefox 61.0.1 on macOS 10.13.6.

@samikeijonen I'm closing this issue for now because I couldn't spot any inline styles such as style="font-size: 36px;" after changing the font size in a paragraph block. If I've missed something, please let me know in the comments!

@samikeijonen
Copy link
Contributor Author

samikeijonen commented Jul 19, 2018

@designsimply Sorry I should have been more clear that this happens in the editor.

Editor have inline styles on large text

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Jul 19, 2018

Hi @samikeijonen, the inline styles are added on purpose on the editor. Soon themes will be able to change the font sizes & classes but if they don't set classes given that when registering a custom size themes told us what the expected size is, on the editor we use the expected font size anyway.
The class should also be applied if it contains other logic besides just the font size.

@samikeijonen
Copy link
Contributor Author

@jorgefilipecosta

Soon themes will be able to change the font sizes

Does that mean something like add_theme_support and those inline font size values would change based on that?

@jorgefilipecosta
Copy link
Member

Does that mean something like add_theme_support and those inline font size values would change based on that?

Exactly, the PR implementing this can be checked in #6628.

@samikeijonen
Copy link
Contributor Author

#6628 is now merged, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants