diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 7e031fa525e1ff..1194359d5c3c6a 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -406,7 +406,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress - **Name:** core/latest-posts - **Category:** widgets - **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor +- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, enableBulletList, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json index 58b1c6da81ca33..2f534392743b3c 100644 --- a/packages/block-library/src/latest-posts/block.json +++ b/packages/block-library/src/latest-posts/block.json @@ -80,6 +80,10 @@ "addLinkToFeaturedImage": { "type": "boolean", "default": false + }, + "enableBulletList": { + "type": "boolean", + "default": true } }, "supports": { @@ -111,18 +115,6 @@ "fontSize": true } }, - "__experimentalBorder": { - "radius": true, - "color": true, - "width": true, - "style": true, - "__experimentalDefaultControls": { - "radius": true, - "color": true, - "width": true, - "style": true - } - }, "interactivity": { "clientNavigation": true } diff --git a/packages/block-library/src/latest-posts/edit.js b/packages/block-library/src/latest-posts/edit.js index 82f0661d04e40f..e91499925c8109 100644 --- a/packages/block-library/src/latest-posts/edit.js +++ b/packages/block-library/src/latest-posts/edit.js @@ -96,6 +96,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { featuredImageSizeWidth, featuredImageSizeHeight, addLinkToFeaturedImage, + enableBulletList, } = attributes; const { imageSizes, @@ -227,6 +228,19 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { const hasPosts = !! latestPosts?.length; const inspectorControls = ( + { postLayout === 'list' && ( + + + setAttributes( { enableBulletList: value } ) + } + /> + + ) } + li { - overflow: hidden; + // overflow: hidden; // Commented out to allow for list-style-type to be displayed in the list item. } } diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php index f8fd8ea27bc453..bde0f5301496ac 100644 --- a/packages/block-library/src/latest-posts/index.php +++ b/packages/block-library/src/latest-posts/index.php @@ -211,6 +211,9 @@ function render_block_core_latest_posts( $attributes ) { if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) { $classes[] = 'has-link-color'; } + if ( isset( $attributes['enableBulletList'] ) && $attributes['enableBulletList'] ) { + $classes[] = 'is-bulleted'; + } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) ); diff --git a/packages/block-library/src/latest-posts/style.scss b/packages/block-library/src/latest-posts/style.scss index 69a4746b5e751c..721842613cb3f4 100644 --- a/packages/block-library/src/latest-posts/style.scss +++ b/packages/block-library/src/latest-posts/style.scss @@ -13,6 +13,12 @@ &.wp-block-latest-posts__list { list-style: none; + &.is-bulleted { + li { + list-style-type: disc; + } + } + li { clear: both; overflow-wrap: break-word;