diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index a27de8211c824a..f23f0bd291067d 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -801,7 +801,7 @@ Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPres - **Name:** core/rss - **Category:** widgets -- **Supports:** align, interactivity (clientNavigation), ~~html~~ +- **Supports:** align, interactivity (clientNavigation), typography (fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textDecoration, textTransform), ~~html~~ - **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search diff --git a/packages/block-library/src/rss/block.json b/packages/block-library/src/rss/block.json index 36d70e7b7ccb98..dbd3571a4cae87 100644 --- a/packages/block-library/src/rss/block.json +++ b/packages/block-library/src/rss/block.json @@ -46,8 +46,26 @@ "html": false, "interactivity": { "clientNavigation": true + }, + "typography": { + "fontSize": true, + "lineHeight": true, + "fontFamily": true, + "fontWeight": true, + "fontStyle": true, + "textTransform": true, + "letterSpacing": true, + "textDecoration": true, + "__experimentalSkipSerialization": [ "textDecoration" ], + "__experimentalDefaultControls": { + "fontSize": true, + "textDecoration": true + } } }, + "selectors": { + "typography": ".wp-block-rss__item" + }, "editorStyle": "wp-block-rss-editor", "style": "wp-block-rss" } diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 85e4e63c9dbf7a..e8e64336d57ebe 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -73,6 +73,11 @@ function render_block_core_rss( $attributes ) { $excerpt = ''; $description = $item->get_description(); + + // Manually add block support text decoration as CSS class. + $text_decoration = $attributes['style']['typography']['textDecoration'] ?? null; + $inline_style = $text_decoration ? sprintf( 'text-decoration: %s;', $text_decoration ) : ''; + if ( $attributes['displayExcerpt'] && ! empty( $description ) ) { $excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) ); $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' […]' ) ); @@ -85,7 +90,7 @@ function render_block_core_rss( $attributes ) { $excerpt = '
' . esc_html( $excerpt ) . '
'; } - $list_items .= "
  • {$title}{$date}{$author}{$excerpt}
  • "; + $list_items .= "
  • {$title}{$date}{$author}{$excerpt}
  • "; } $classnames = array(); diff --git a/packages/block-library/src/rss/style.scss b/packages/block-library/src/rss/style.scss index f7360ec76f85ac..21c94af6a4bdf0 100644 --- a/packages/block-library/src/rss/style.scss +++ b/packages/block-library/src/rss/style.scss @@ -27,6 +27,12 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl } } + // This is to prevent default a tag styling from being applied to the rss block. + & :where(a), + & :where(a:focus), + & :where(a:active) { + text-decoration: none; + } @include break-small { @for $i from 2 through 6 { &.columns-#{ $i } li { @@ -41,3 +47,4 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl display: block; font-size: 0.8125em; } +