Skip to content

Commit

Permalink
Mobile - DefaultBlockAppender - Set font size to match Paragraph's bl…
Browse files Browse the repository at this point in the history
…ock font size for block-based themes
  • Loading branch information
Gerardo committed Sep 10, 2023
1 parent bd8dead commit cd5411d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };
const noop = () => {};

export function DefaultBlockAppender( {
baseGlobalStyles,
isLocked,
isVisible,
onAppend,
Expand All @@ -34,6 +35,8 @@ export function DefaultBlockAppender( {
if ( isLocked || ! isVisible ) {
return null;
}
const blockGlobalStyles = baseGlobalStyles?.blocks?.[ 'core/paragraph' ];
const textStyles = blockGlobalStyles?.typography ?? undefined;

const value =
typeof placeholder === 'string'
Expand All @@ -55,6 +58,7 @@ export function DefaultBlockAppender( {
placeholder={ value }
onChange={ noop }
tagName="p"
style={ textStyles }
/>
) }
</View>
Expand All @@ -64,16 +68,24 @@ export function DefaultBlockAppender( {

export default compose(
withSelect( ( select, ownProps ) => {
const { getBlockCount, getBlockName, isBlockValid, getTemplateLock } =
select( blockEditorStore );
const {
getBlockCount,
getBlockName,
getSettings,
isBlockValid,
getTemplateLock,
} = select( blockEditorStore );

const isEmpty = ! getBlockCount( ownProps.rootClientId );
const isLastBlockDefault =
getBlockName( ownProps.lastBlockClientId ) ===
getDefaultBlockName();
const isLastBlockValid = isBlockValid( ownProps.lastBlockClientId );
const globalStylesBaseStyles =
getSettings()?.__experimentalGlobalStylesBaseStyles;

return {
baseGlobalStyles: globalStylesBaseStyles,
isVisible: isEmpty || ! isLastBlockDefault || ! isLastBlockValid,
isLocked: !! getTemplateLock( ownProps.rootClientId ),
};
Expand Down

0 comments on commit cd5411d

Please sign in to comment.