Skip to content

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

Merged
jorgefilipecosta merged 1 commit intomasterfrom
fix/allow-setting-empty-array-on-font-sizes-is-impossible
Feb 12, 2019
Merged

Fix: Impossible to set empty array on editor-font-sizes.#13824
jorgefilipecosta merged 1 commit intomasterfrom
fix/allow-setting-empty-array-on-font-sizes-is-impossible

Conversation

@jorgefilipecosta
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

@aduth
Copy link
Copy Markdown
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