From e98c06d20b6fcdf9be4ff7d61931639f02917bbf Mon Sep 17 00:00:00 2001 From: benazeer-ben Date: Thu, 14 Nov 2024 12:25:53 +0530 Subject: [PATCH] Doc Build --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/rss/block.json | 17 +++++++++++- packages/block-library/src/rss/edit.js | 6 +++++ packages/block-library/src/rss/index.php | 4 +++ packages/block-library/src/rss/style.scss | 33 +++++++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index a27de8211c824..090a166fc287a 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 (c,lientNavigation), 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 36d70e7b7ccb9..b125d10f6db85 100644 --- a/packages/block-library/src/rss/block.json +++ b/packages/block-library/src/rss/block.json @@ -45,7 +45,22 @@ "align": true, "html": false, "interactivity": { - "clientNavigation": true + "c,lientNavigation": 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 + } } }, "editorStyle": "wp-block-rss-editor", diff --git a/packages/block-library/src/rss/edit.js b/packages/block-library/src/rss/edit.js index b67cb4f9193df..316762221c2aa 100644 --- a/packages/block-library/src/rss/edit.js +++ b/packages/block-library/src/rss/edit.js @@ -57,6 +57,7 @@ export default function RSSEdit( { attributes, setAttributes } ) { } const blockProps = useBlockProps(); + const textDecoration = attributes.style?.typography?.textDecoration; const label = __( 'RSS URL' ); @@ -190,6 +191,11 @@ export default function RSSEdit( { attributes, setAttributes } ) { diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 85e4e63c9dbf7..02094c803cec8 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -104,6 +104,10 @@ function render_block_core_rss( $attributes ) { if ( $attributes['displayExcerpt'] ) { $classnames[] = 'has-excerpts'; } + // Manually add block support text decoration as CSS class. + $text_decoration = $attributes['style']['typography']['textDecoration'] ?? null; + $text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration ); + $classnames[] = $text_decoration ? $text_decoration_class : ''; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); diff --git a/packages/block-library/src/rss/style.scss b/packages/block-library/src/rss/style.scss index f7360ec76f85a..b858c58521ff8 100644 --- a/packages/block-library/src/rss/style.scss +++ b/packages/block-library/src/rss/style.scss @@ -26,7 +26,40 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl width: 100%; } } + // The following rules provide class based application of user selected text + // decoration via block supports. + &.has-text-decoration-underline li.wp-block-rss__item a { + text-decoration: underline; + &:focus, + &:active { + text-decoration: underline; + } + } + + &.has-text-decoration-line-through li.wp-block-rss__item a { + text-decoration: line-through; + + &:focus, + &:active { + text-decoration: line-through; + } + } + + &.has-text-decoration-none li.wp-block-rss__item a { + text-decoration: none; + + &:focus, + &:active { + text-decoration: none; + } + } + + & :where(a), + & :where(a:focus), + & :where(a:active) { + text-decoration: none; + } @include break-small { @for $i from 2 through 6 { &.columns-#{ $i } li {