Skip to content

Commit

Permalink
Rnmobile/fix font size breakage (#21527)
Browse files Browse the repository at this point in the history
* Hide typography controls in mobile

* Add hooks for font-size

This allow that font size attributes are still read and saved
properly in mobile.
  • Loading branch information
SergioEstevao committed Apr 10, 2020
1 parent 528c871 commit 3130e85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/src/hooks/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import './custom-class-name';
import './generated-class-name';
import './style';
import './color';
import './font-size';
16 changes: 6 additions & 10 deletions packages/block-editor/src/hooks/line-height.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
import { Platform } from '@wordpress/element';
import { hasBlockSupport } from '@wordpress/blocks';

/**
Expand Down Expand Up @@ -41,13 +40,10 @@ export function LineHeightEdit( props ) {
style: cleanEmptyObject( newStyle ),
} );
};
return Platform.select( {
web: (
<LineHeightControl
value={ style?.typography?.lineHeight }
onChange={ onChange }
/>
),
native: null,
} );
return (
<LineHeightControl
value={ style?.typography?.lineHeight }
onChange={ onChange }
/>
);
}
3 changes: 2 additions & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { hasBlockSupport } from '@wordpress/blocks';
import { createHigherOrderComponent } from '@wordpress/compose';
import { PanelBody } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { Platform } from '@wordpress/element';

/**
* Internal dependencies
Expand Down Expand Up @@ -144,7 +145,7 @@ export const withBlockControls = createHigherOrderComponent(
);

return [
hasTypographySupport && (
Platform.OS === 'web' && hasTypographySupport && (
<InspectorControls key="typography">
<PanelBody title={ __( 'Typography' ) }>
<FontSizeEdit { ...props } />
Expand Down

0 comments on commit 3130e85

Please sign in to comment.