Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Breaking Changes

- The `__next40pxDefaultSize` prop is now true by default. The prop can be safely removed from the following:
- `FontFamilyControl` ([#79593](https://github.com/WordPress/gutenberg/pull/79593)).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Placing it at the top of the list instead of the bottom, nice conflict avoidance :D

- `LetterSpacingControl` ([#79533](https://github.com/WordPress/gutenberg/pull/79533)).
- `LineHeightControl` ([#79589](https://github.com/WordPress/gutenberg/pull/79589)).

Expand Down
9 changes: 0 additions & 9 deletions packages/block-editor/src/components/font-family/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const MyFontFamilyControl = () => {
onChange={ ( newFontFamily ) => {
setFontFamily( newFontFamily );
} }
__next40pxDefaultSize
/>
);
};
Expand Down Expand Up @@ -74,11 +73,3 @@ The current font family value.
- Default: ''

The rest of the props are passed down to the underlying `<SelectControl />` instance.

#### `__next40pxDefaultSize`

- Type: `boolean`
- Required: No
- Default: `false`

Start opting into the larger default height that will become the default size in a future version.
26 changes: 7 additions & 19 deletions packages/block-editor/src/components/font-family/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import clsx from 'clsx';
* WordPress dependencies
*/
import { CustomSelectControl } from '@wordpress/components';
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -16,8 +15,12 @@ import { __ } from '@wordpress/i18n';
import { useSettings } from '../use-settings';

export default function FontFamilyControl( {
/** Start opting into the larger default height that will become the default size in a future version. */
__next40pxDefaultSize = false,
/**
* Start opting into the larger default height that will become the default size in a future version.
*
* @deprecated Default behavior since WordPress 7.1. Prop can be safely removed.
*/
__next40pxDefaultSize: _next40pxDefaultSize,
value = '',
onChange,
fontFamilies,
Expand Down Expand Up @@ -45,26 +48,11 @@ export default function FontFamilyControl( {
} ) ),
];

if (
! __next40pxDefaultSize &&
( props.size === undefined || props.size === 'default' )
) {
deprecated(
`36px default size for wp.blockEditor.__experimentalFontFamilyControl`,
{
since: '6.8',
version: '7.1',
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',
}
);
}

const selectedValue =
options.find( ( option ) => option.key === value ) ?? '';
return (
<CustomSelectControl
__next40pxDefaultSize={ __next40pxDefaultSize }
__shouldNotWarnDeprecated36pxSize
__next40pxDefaultSize
label={ __( 'Font' ) }
value={ selectedValue }
onChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ export const Default = {
slug: 'system-font',
},
],
__next40pxDefaultSize: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ export default function TypographyPanel( {
fontFamilies={ fontFamilies }
value={ fontFamily }
onChange={ setFontFamily }
size="__unstable-large"
/>
</ToolsPanelItem>
) }
Expand Down Expand Up @@ -662,7 +661,6 @@ export default function TypographyPanel( {
__unstableInputWidth="auto"
value={ lineHeight }
onChange={ setLineHeight }
size="__unstable-large"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Cleaning up a spot missed in #79589.

/>
</ToolsPanelItem>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ The following components are checked by this rule:
- ComboboxControl
- CustomSelectControl
- FontAppearanceControl
- FontFamilyControl
- FormFileUpload (special case - see below)
- FormTokenField
- InputControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
ComboboxControl,
CustomSelectControl,
FontAppearanceControl,
FontFamilyControl,
FormTokenField,
InputControl,
NumberControl,
Expand All @@ -126,7 +125,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
<ComboboxControl __next40pxDefaultSize />
<CustomSelectControl __next40pxDefaultSize />
<FontAppearanceControl __next40pxDefaultSize />
<FontFamilyControl __next40pxDefaultSize />
<FormTokenField __next40pxDefaultSize />
<InputControl __next40pxDefaultSize />
<NumberControl __next40pxDefaultSize />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const COMPONENTS_REQUIRING_40PX = new Set( [
'ComboboxControl',
'CustomSelectControl',
'FontAppearanceControl',
'FontFamilyControl',
'FormTokenField',
'IconButton',
'InputControl',
Expand Down
1 change: 1 addition & 0 deletions tools/eslint/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const restrictedSyntax = [
'BorderControl',
'BoxControl',
'FocalPointPicker',
'FontFamilyControl',
'FontSizePicker',
'LetterSpacingControl',
'LineHeightControl',
Expand Down
Loading