Skip to content

Commit

Permalink
Block Editor: Update WordPress Packages; Remove navigation block; Add…
Browse files Browse the repository at this point in the history
… social links block

The following package versions were changed:
@wordpress/annotations: 1.11.0 -> 1.12.0
@wordpress/api-fetch: 3.10.0 -> 3.11.0
@wordpress/block-directory: 1.4.0 -> 1.5.0
@wordpress/block-editor: 3.6.0 -> 3.7.0
@wordpress/block-library: 2.13.0 -> 2.14.0
@wordpress/blocks: 6.11.0 -> 6.12.0
@wordpress/components: 9.1.0 -> 9.2.0
@wordpress/core-data: 2.11.0 -> 2.12.0
@wordpress/data: 4.13.0 -> 4.14.0
@wordpress/data-controls: 1.7.0 -> 1.8.0
@wordpress/e2e-test-utils: 4.2.0 -> 4.3.0
@wordpress/edit-post: 3.12.0 -> 3.13.0
@wordpress/editor: 9.11.0 -> 9.12.0
@wordpress/format-library: 1.13.0 -> 1.14.0
@wordpress/icons: 1.0.0 -> 1.1.0
@wordpress/keyboard-shortcuts: 1.0.0 -> 1.1.0
@wordpress/list-reusable-blocks: 1.12.0 -> 1.13.0
@wordpress/media-utils: 1.6.0 -> 1.7.0
@wordpress/notices: 1.12.0 -> 2.0.0
@wordpress/nux: 3.11.0 -> 3.12.0
@wordpress/plugins: 2.11.0 -> 2.12.0
@wordpress/primitives: 1.0.0 -> 1.1.0
@wordpress/rich-text: 3.11.0 -> 3.12.0
@wordpress/server-side-render: 1.7.0 -> 1.8.0
@wordpress/url: 2.10.0 -> 2.11.0
@wordpress/viewport: 2.12.0 -> 2.13.0
The navigation block inclusion was reverted.
The social links block was included.

Props gziolo, youknowriad, mcsf, noisysocks.
Fixes #49397.

git-svn-id: https://develop.svn.wordpress.org/trunk@47250 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
jorgefilipecosta committed Feb 10, 2020
1 parent de5d82f commit f558f5f
Show file tree
Hide file tree
Showing 11 changed files with 831 additions and 745 deletions.
835 changes: 430 additions & 405 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@wordpress/custom-templated-path-webpack-plugin": "1.6.0",
"@wordpress/dependency-extraction-webpack-plugin": "2.2.0",
"@wordpress/e2e-test-utils": "4.2.0",
"@wordpress/e2e-test-utils": "4.3.0",
"@wordpress/library-export-default-webpack-plugin": "1.6.0",
"@wordpress/scripts": "6.2.0",
"autoprefixer": "9.6.2",
Expand Down Expand Up @@ -73,50 +73,50 @@
"dependencies": {
"@babel/polyfill": "7.4.4",
"@wordpress/a11y": "2.7.0",
"@wordpress/annotations": "1.11.0",
"@wordpress/api-fetch": "3.10.0",
"@wordpress/annotations": "1.12.0",
"@wordpress/api-fetch": "3.11.0",
"@wordpress/autop": "2.6.0",
"@wordpress/blob": "2.7.0",
"@wordpress/block-directory": "1.4.0",
"@wordpress/block-editor": "3.6.0",
"@wordpress/block-library": "2.13.0",
"@wordpress/block-directory": "1.5.0",
"@wordpress/block-editor": "3.7.0",
"@wordpress/block-library": "2.14.0",
"@wordpress/block-serialization-default-parser": "3.5.0",
"@wordpress/blocks": "6.11.0",
"@wordpress/components": "9.1.0",
"@wordpress/blocks": "6.12.0",
"@wordpress/components": "9.2.0",
"@wordpress/compose": "3.11.0",
"@wordpress/core-data": "2.11.0",
"@wordpress/data": "4.13.0",
"@wordpress/data-controls": "1.7.0",
"@wordpress/core-data": "2.12.0",
"@wordpress/data": "4.14.0",
"@wordpress/data-controls": "1.8.0",
"@wordpress/date": "3.8.0",
"@wordpress/deprecated": "2.7.0",
"@wordpress/dom": "2.8.0",
"@wordpress/dom-ready": "2.7.0",
"@wordpress/edit-post": "3.12.0",
"@wordpress/editor": "9.11.0",
"@wordpress/edit-post": "3.13.0",
"@wordpress/editor": "9.12.0",
"@wordpress/element": "2.11.0",
"@wordpress/escape-html": "1.7.0",
"@wordpress/format-library": "1.13.0",
"@wordpress/format-library": "1.14.0",
"@wordpress/hooks": "2.7.0",
"@wordpress/html-entities": "2.6.0",
"@wordpress/i18n": "3.9.0",
"@wordpress/icons": "1.0.0",
"@wordpress/icons": "1.1.0",
"@wordpress/is-shallow-equal": "1.8.0",
"@wordpress/keyboard-shortcuts": "1.0.0",
"@wordpress/keyboard-shortcuts": "1.1.0",
"@wordpress/keycodes": "2.9.0",
"@wordpress/list-reusable-blocks": "1.12.0",
"@wordpress/media-utils": "1.6.0",
"@wordpress/notices": "1.12.0",
"@wordpress/nux": "3.11.0",
"@wordpress/plugins": "2.11.0",
"@wordpress/primitives": "1.0.0",
"@wordpress/list-reusable-blocks": "1.13.0",
"@wordpress/media-utils": "1.7.0",
"@wordpress/notices": "2.0.0",
"@wordpress/nux": "3.12.0",
"@wordpress/plugins": "2.12.0",
"@wordpress/primitives": "1.1.0",
"@wordpress/priority-queue": "1.5.0",
"@wordpress/redux-routine": "3.7.0",
"@wordpress/rich-text": "3.11.0",
"@wordpress/server-side-render": "1.7.0",
"@wordpress/rich-text": "3.12.0",
"@wordpress/server-side-render": "1.8.0",
"@wordpress/shortcode": "2.6.0",
"@wordpress/token-list": "1.9.0",
"@wordpress/url": "2.10.0",
"@wordpress/viewport": "2.12.0",
"@wordpress/url": "2.11.0",
"@wordpress/viewport": "2.13.0",
"@wordpress/warning": "1.0.0",
"@wordpress/wordcount": "2.7.0",
"backbone": "1.4.0",
Expand Down
60 changes: 52 additions & 8 deletions src/wp-includes/blocks/latest-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,42 @@ function render_block_core_latest_posts( $attributes ) {

$list_items_markup = '';

$excerpt_length = $attributes['excerptLength'];

foreach ( $recent_posts as $post ) {
$list_items_markup .= '<li>';

if ( $attributes['displayFeaturedImage'] && has_post_thumbnail( $post ) ) {
$image_style = '';
if ( isset( $attributes['featuredImageSizeWidth'] ) ) {
$image_style .= sprintf( 'max-width:%spx;', $attributes['featuredImageSizeWidth'] );
}
if ( isset( $attributes['featuredImageSizeHeight'] ) ) {
$image_style .= sprintf( 'max-height:%spx;', $attributes['featuredImageSizeHeight'] );
}

$image_classes = 'wp-block-latest-posts__featured-image';
if ( isset( $attributes['featuredImageAlign'] ) ) {
$image_classes .= ' align' . $attributes['featuredImageAlign'];
}

$list_items_markup .= sprintf(
'<div class="%1$s">%2$s</div>',
$image_classes,
get_the_post_thumbnail(
$post,
$attributes['featuredImageSizeSlug'],
array(
'style' => $image_style,
)
)
);
}

$title = get_the_title( $post );
if ( ! $title ) {
$title = __( '(no title)' );
}
$list_items_markup .= sprintf(
'<li><a href="%1$s">%2$s</a>',
'<a href="%1$s">%2$s</a>',
esc_url( get_permalink( $post ) ),
$title
);
Expand All @@ -52,11 +79,8 @@ function render_block_core_latest_posts( $attributes ) {

if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
&& isset( $attributes['displayPostContentRadio'] ) && 'excerpt' === $attributes['displayPostContentRadio'] ) {
$post_excerpt = $post->post_excerpt;
if ( ! ( $post_excerpt ) ) {
$post_excerpt = $post->post_content;
}
$trimmed_excerpt = esc_html( wp_trim_words( $post_excerpt, $excerpt_length, ' &hellip; ' ) );

$trimmed_excerpt = get_the_excerpt( $post );

$list_items_markup .= sprintf(
'<div class="wp-block-latest-posts__post-excerpt">%1$s',
Expand Down Expand Up @@ -169,6 +193,26 @@ function register_block_core_latest_posts() {
'type' => 'string',
'default' => 'date',
),
'displayFeaturedImage' => array(
'type' => 'boolean',
'default' => false,
),
'featuredImageAlign' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right' ),
),
'featuredImageSizeSlug' => array(
'type' => 'string',
'default' => 'thumbnail',
),
'featuredImageSizeWidth' => array(
'type' => 'number',
'default' => null,
),
'featuredImageSizeHeight' => array(
'type' => 'number',
'default' => null,
),
),
'render_callback' => 'render_block_core_latest_posts',
)
Expand Down
Loading

0 comments on commit f558f5f

Please sign in to comment.