Skip to content

Commit

Permalink
Doc Build
Browse files Browse the repository at this point in the history
  • Loading branch information
benazeer-ben committed Nov 14, 2024
1 parent a8a8747 commit e98c06d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion packages/block-library/src/rss/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions packages/block-library/src/rss/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function RSSEdit( { attributes, setAttributes } ) {
}

const blockProps = useBlockProps();
const textDecoration = attributes.style?.typography?.textDecoration;

const label = __( 'RSS URL' );

Expand Down Expand Up @@ -190,6 +191,11 @@ export default function RSSEdit( { attributes, setAttributes } ) {
<ServerSideRender
block="core/rss"
attributes={ attributes }
className={
textDecoration
? 'has-text-decoration-' + textDecoration
: textDecoration
}
/>
</Disabled>
</div>
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/rss/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) );

Expand Down
33 changes: 33 additions & 0 deletions packages/block-library/src/rss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e98c06d

Please sign in to comment.