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

LineHeightControl: Hard deprecate bottom margin #64281

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking Changes

- `LineHeightControl`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#64281](https://github.com/WordPress/gutenberg/pull/64281)).

## 13.4.0 (2024-07-24)

## 13.3.0 (2024-07-10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ export default function TypographyPanel( {
panelId={ panelId }
>
<LineHeightControl
__nextHasNoMarginBottom
__unstableInputWidth="auto"
value={ lineHeight }
onChange={ setLineHeight }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const MyLineHeightControl = () => (
<LineHeightControl
value={ lineHeight }
onChange={ onChange }
__nextHasNoMarginBottom={ true }
/>
);
```
Expand All @@ -37,13 +36,6 @@ The value of the line height.

A callback function that handles the application of the line height value.

#### `__nextHasNoMarginBottom`

- **Type:** `boolean`
- **Default:** `false`

Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)

## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';

Expand All @@ -19,8 +18,6 @@ import {
const LineHeightControl = ( {
value: lineHeight,
onChange,
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
__unstableInputWidth = '60px',
...otherProps
} ) => {
Expand Down Expand Up @@ -76,20 +73,6 @@ const LineHeightControl = ( {

const value = isDefined ? lineHeight : RESET_VALUE;

if ( ! __nextHasNoMarginBottom ) {
deprecated(
'Bottom margin styles for wp.blockEditor.LineHeightControl',
{
since: '6.0',
version: '6.4',
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
}
);
}
const deprecatedStyles = __nextHasNoMarginBottom
? undefined
: { marginBottom: 24 };

const handleOnChange = ( nextValue, { event } ) => {
if ( nextValue === '' ) {
onChange();
Expand All @@ -105,10 +88,7 @@ const LineHeightControl = ( {
};

return (
<div
className="block-editor-line-height-control"
style={ deprecatedStyles }
>
<div className="block-editor-line-height-control">
<NumberControl
{ ...otherProps }
__unstableInputWidth={ __unstableInputWidth }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const Template = ( props ) => {

export const Default = Template.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
__unstableInputWidth: '100px',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ const SPIN = STEP * SPIN_FACTOR;

const ControlledLineHeightControl = () => {
const [ value, setValue ] = useState();
return (
<LineHeightControl
value={ value }
onChange={ setValue }
__nextHasNoMarginBottom
/>
);
return <LineHeightControl value={ value } onChange={ setValue } />;
};

describe( 'LineHeightControl', () => {
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/hooks/line-height.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function LineHeightEdit( props ) {
return (
<LineHeightControl
__unstableInputWidth="100%"
__nextHasNoMarginBottom
value={ style?.typography?.lineHeight }
onChange={ onChange }
size="__unstable-large"
Expand Down
Loading