Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#46290 closed defect (bug) (fixed)

Port from Gutenberg editor: Fix: Impossible to set empty array on editor-font-sizes.

Reported by: jorgefilipecosta Owned by: desrosj
Priority: normal Milestone: 5.2
Component: Editor Version: 5.0
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

This ticket ports to core a fix already applied in the Gutenberg editor plugin.
This part of the code is going to be removed from the plugin so it is important to get this change on the core.
Gutenberg PR: ​https://github.com/WordPress/gutenberg/pull/13824

More details:
When setting an empty array on editor-font-sizes theme support setting nothing happens, and the default font-sizes were used by the editor.
This patch fixes the problem and makes sure that when add_theme_support('editor-color-palette', array()); is added no available font sizes appear on the editor. This patch 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.

Attachments (3)

46290.diff​ (394 bytes ) - added by jorgefilipecosta 8 years ago.
empty-font-sizes-dropdown.png​ (14.4 KB ) - added by desrosj 8 years ago.
no-empty-dropdown.png​ (16.0 KB ) - added by desrosj 8 years ago.

Download all attachments as: .zip

Change History (14)

#1 @pento
8 years ago

  • Keywords commit added
  • Milestone Awaiting Review → 5.1.1
  • Version trunk → 5.0

#2 @SergeyBiryukov
8 years ago

  • Component General → Editor

#3 @SergeyBiryukov
8 years ago

  • Keywords dev-reviewed added

46290.diff​ looks good to me.

This ticket was mentioned in ​Slack in #core by lukecarbis. ​View the logs.


8 years ago

#5 @desrosj
8 years ago

  • Owner set to desrosj
  • Status new → assigned

#6 @desrosj
8 years ago

  • Resolution → fixed
  • Status assigned → closed

In 44782:

Editor: Allow the default font size options to be removed.

Similar to editor-color-palette, a theme or plugin should be able to set the theme support for editor-font-sizes to an empty array, indicating that no additional font sizes should be available in the block’s ‘Text Settings’. The current conditional was using empty(), which was incorrectly causing the default font sizes to be used instead.

Props jorgefilipecosta, chrisvanpatten, SergeyBiryukov.
Fixes #46290.

#7 @desrosj
8 years ago

  • Resolution fixed
  • Status closed → reopened

Reopening for backport consideration.

I was going to note that even after setting editor-font-sizes to array(), the dropdown still "opens". But, that ​seems to be fixed upstream and can be expected in 5.2.

Wondering if we should not backport this so the bug is not visible.

Last edited 8 years ago by desrosj (previous) (diff)

#8 @desrosj
8 years ago

I previously included the wrong upstream link for the bug I detailed. The correct PR is this one: ​https://github.com/WordPress/gutenberg/pull/13782.

This ticket was mentioned in ​Slack in #core by desrosj. ​View the logs.


8 years ago

#10 @pbiron
8 years ago

  • Milestone 5.1.1 → 5.2

During the 5.1.1 bug scrub today, it was decided to punt this to 5.2.

#11 @desrosj
8 years ago

  • Keywords commit dev-reviewed removed
  • Resolution → fixed
  • Status reopened → closed

I have tested this after the changes from ​https://github.com/WordPress/gutenberg/pull/13782GB-13782 were merged into trunk in [44808], and the field no longer displays an empty dropdown when an empty array is specified as the value for editor-font-sizes theme support.

Note: See TracTickets for help on using tickets.