Skip to content

Commit

Permalink
Fix issue with strikethrough and underline not showing in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Davies committed May 12, 2021
1 parent a1ae16f commit bc8e22e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/block-library/src/site-title/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ export default function SiteTitleEdit( {
setAttributes,
insertBlocksAfter,
} ) {
const { level, textAlign } = attributes;
const { level, textAlign, style: { typography } = {} } = attributes;
const [ title, setTitle ] = useEntityProp( 'root', 'site', 'title' );
const TagName = level === 0 ? 'p' : `h${ level }`;
const blockProps = useBlockProps( {
className: classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
} );

// Text decoration is not applied to a nested inline block so need to pass this down to
// richtext child element.
const textDecoration = typography?.textDecoration
? typography?.textDecoration
: undefined;

return (
<>
<BlockControls group="block">
Expand All @@ -53,7 +60,10 @@ export default function SiteTitleEdit( {
<TagName { ...blockProps }>
<RichText
tagName="a"
style={ { display: 'inline-block' } }
style={ {
display: 'inline-block',
textDecoration,
} }
aria-label={ __( 'Site title text' ) }
placeholder={ __( 'Write site title…' ) }
value={ title }
Expand Down

0 comments on commit bc8e22e

Please sign in to comment.