Skip to content

Commit

Permalink
Post Title Block: Add style attributes (#24246)
Browse files Browse the repository at this point in the history
- Add support for text and background colors, line height, font size to the Post Title block.
- Fix an issue causing the `HeadingLevelDropdown` to move to the top of the page when changing the heading level.
  • Loading branch information
Copons authored Jul 28, 2020
1 parent 478c31c commit a260cda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true
},
"__experimentalFontSize": true,
"__experimentalLineHeight": true,
"__experimentalSelector": {
"core/post-title/h1": "h1",
"core/post-title/h2": "h2",
Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default function PostTitleEdit( {
return null;
}

const BlockWrapper = Block[ tagName ];

return (
<>
<BlockControls>
Expand All @@ -61,14 +63,13 @@ export default function PostTitleEdit( {
} }
/>
</BlockControls>
<Block
tagName={ tagName }
<BlockWrapper
className={ classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ) }
>
{ post.title || __( 'Post Title' ) }
</Block>
</BlockWrapper>
</>
);
}

0 comments on commit a260cda

Please sign in to comment.