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
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export default function TypographyPanel( {
immutableSet( value, [ 'typography', 'lineHeight' ], newValue )
);
};
const hasLineHeight = () => !! value?.typography?.lineHeight;
const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kept this tweak to the line height value detection so it can correctly check any old numeric line-height values that might be 0 in existing blocks/styles.

const resetLineHeight = () => setLineHeight( undefined );

// Letter Spacing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,17 @@ const LineHeightControl = ( {
: { marginBottom: 24 };

const handleOnChange = ( nextValue, { event } ) => {
if ( nextValue === '' ) {
onChange();
return;
}
Comment on lines +88 to +91
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed if we land #49750 which changes cleanEmptyObject to keep anything that !== undefined.

It also allows the following onChange calls to simply convert the value to a string improving zero value handling.


if ( event.type === 'click' ) {
onChange( adjustNextValue( nextValue, false ) );
onChange( adjustNextValue( `${ nextValue }`, false ) );
return;
}

onChange( nextValue );
onChange( `${ nextValue }` );
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Template = ( props ) => {
export const Default = Template.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
__unstableInputWidth: '60px',
__unstableInputWidth: '100px',
};

export const UnconstrainedWidth = Template.bind( {} );
Expand Down