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

Fix: Impossible to set empty array on editor-font-sizes. #13824

Conversation

jorgefilipecosta
Copy link
Member

Description

When setting an empty array on editor-font-sizes nothing happens, and the default font-sizes are used.
This PR's fixes the problem and makes sure that when add_theme_support('editor-color-palette', array()); is added no available font sizes appear in the font size picker. This PR uses the same approach used in colors and makes the behavior consistent with what happens when an empty array is set on editor-color-palette.

This change needs to be ported into core.

How has this been tested?

I changed the default font sizes of twenty nineteen theme to:

		add_theme_support(
			'editor-font-sizes',
			array()
		);

I verified no default font sizes appear on the editor and just the custom size picker is available.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked. labels Feb 11, 2019
Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

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

Looks good to me; excited for more font size improvements to land :)

@jorgefilipecosta jorgefilipecosta merged commit 15ecbb0 into master Feb 12, 2019
@jorgefilipecosta jorgefilipecosta deleted the fix/allow-setting-empty-array-on-font-sizes-is-impossible branch February 12, 2019 09:15
@youknowriad youknowriad added this to the 5.1 (Gutenberg) milestone Feb 12, 2019
Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Most all of this code in client-assets.php is going away (#13569), we should avoid making changes here.

What patch (if any) do we need to make to core to ensure this is reflected upstream?

@aduth
Copy link
Member

aduth commented Feb 20, 2019

@jorgefilipecosta Is there an associated core Trac issue I can follow for applying the fix to core?

@jorgefilipecosta
Copy link
Member Author

Hi @aduth, I'm sorry I missed the pings, I added a core patch in https://core.trac.wordpress.org/ticket/46290.

@aduth
Copy link
Member

aduth commented Feb 20, 2019

Thanks @jorgefilipecosta 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants