Editor: update JavaScript packages

Also update default block categories

Props youknowriad, gziolo, aduth.
Fixes #50420, #50278.



git-svn-id: https://develop.svn.wordpress.org/trunk@48177 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ella van Durpe 2020-06-26 13:31:11 +00:00
parent 7ce1ba7f98
commit 24465974cd
18 changed files with 7508 additions and 5842 deletions

View File

@ -25,17 +25,16 @@ env:
- WP_INSTALL: true
- PHP_FPM_UID: "`id -u`"
- PHP_FPM_GID: "`id -g`"
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
jobs:
include:
- env: WP_TRAVISCI=test:e2e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
- env: WP_TRAVISCI=test:e2e
name: E2E Tests
- env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
name: PHP Linting
- env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
name: "PHP Compatibility Check"
- env: WP_TRAVISCI=travis:js WP_INSTALL=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
- env: WP_TRAVISCI=travis:js WP_INSTALL=false
name: JS Tests
- env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.4"
@ -76,7 +75,7 @@ before_script:
fi
- npm --version
- node --version
- nvm install 10.13.0
- nvm install --latest-npm
- |
if [[ "$NPM_INSTALL" == "true" ]]; then
npm ci

12815
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,11 +25,11 @@
"last 2 Opera versions"
],
"devDependencies": {
"@wordpress/custom-templated-path-webpack-plugin": "1.6.0",
"@wordpress/dependency-extraction-webpack-plugin": "2.4.0",
"@wordpress/e2e-test-utils": "4.3.1",
"@wordpress/library-export-default-webpack-plugin": "1.6.0",
"@wordpress/scripts": "6.2.0",
"@wordpress/custom-templated-path-webpack-plugin": "1.7.0",
"@wordpress/dependency-extraction-webpack-plugin": "2.8.0",
"@wordpress/e2e-test-utils": "4.10.0",
"@wordpress/library-export-default-webpack-plugin": "1.7.0",
"@wordpress/scripts": "12.0.0",
"autoprefixer": "9.6.2",
"check-node-version": "4.0.1",
"copy-webpack-plugin": "^5.1.1",
@ -63,6 +63,7 @@
"jquery-migrate": "1.4.1",
"matchdep": "~2.0.0",
"node-sass": "~4.14.1",
"puppeteer": "npm:puppeteer-core@3.0.0",
"qunit": "~2.9.0",
"sinon": "~9.0.0",
"sinon-test": "~3.0.0",
@ -76,53 +77,53 @@
},
"dependencies": {
"@babel/polyfill": "7.4.4",
"@wordpress/a11y": "2.7.0",
"@wordpress/annotations": "1.12.3",
"@wordpress/api-fetch": "3.11.0",
"@wordpress/autop": "2.6.0",
"@wordpress/blob": "2.7.0",
"@wordpress/block-directory": "1.5.8",
"@wordpress/block-editor": "3.7.8",
"@wordpress/block-library": "2.14.8",
"@wordpress/block-serialization-default-parser": "3.5.0",
"@wordpress/blocks": "6.12.3",
"@wordpress/components": "9.2.6",
"@wordpress/compose": "3.11.0",
"@wordpress/core-data": "2.12.3",
"@wordpress/data": "4.14.2",
"@wordpress/data-controls": "1.8.2",
"@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.13.10",
"@wordpress/editor": "9.12.8",
"@wordpress/element": "2.11.0",
"@wordpress/escape-html": "1.7.0",
"@wordpress/format-library": "1.14.8",
"@wordpress/hooks": "2.7.0",
"@wordpress/html-entities": "2.6.0",
"@wordpress/i18n": "3.9.0",
"@wordpress/icons": "1.1.0",
"@wordpress/is-shallow-equal": "1.8.0",
"@wordpress/keyboard-shortcuts": "1.1.2",
"@wordpress/keycodes": "2.9.0",
"@wordpress/list-reusable-blocks": "1.13.6",
"@wordpress/media-utils": "1.7.2",
"@wordpress/notices": "2.0.2",
"@wordpress/nux": "3.12.6",
"@wordpress/plugins": "2.12.0",
"@wordpress/primitives": "1.1.0",
"@wordpress/priority-queue": "1.5.1",
"@wordpress/redux-routine": "3.7.0",
"@wordpress/rich-text": "3.12.2",
"@wordpress/server-side-render": "1.8.6",
"@wordpress/shortcode": "2.6.0",
"@wordpress/token-list": "1.9.0",
"@wordpress/url": "2.11.0",
"@wordpress/viewport": "2.13.2",
"@wordpress/warning": "1.0.0",
"@wordpress/wordcount": "2.7.0",
"@wordpress/a11y": "2.11.0",
"@wordpress/annotations": "1.19.0",
"@wordpress/api-fetch": "3.18.0",
"@wordpress/autop": "2.9.0",
"@wordpress/blob": "2.9.0",
"@wordpress/block-directory": "1.12.0",
"@wordpress/block-editor": "4.2.0",
"@wordpress/block-library": "2.21.0",
"@wordpress/block-serialization-default-parser": "3.7.0",
"@wordpress/blocks": "6.19.0",
"@wordpress/components": "9.9.0",
"@wordpress/compose": "3.18.0",
"@wordpress/core-data": "2.19.0",
"@wordpress/data": "4.21.0",
"@wordpress/data-controls": "1.15.0",
"@wordpress/date": "3.10.0",
"@wordpress/deprecated": "2.9.0",
"@wordpress/dom": "2.12.0",
"@wordpress/dom-ready": "2.10.0",
"@wordpress/edit-post": "3.20.0",
"@wordpress/editor": "9.19.0",
"@wordpress/element": "2.15.0",
"@wordpress/escape-html": "1.9.0",
"@wordpress/format-library": "1.21.0",
"@wordpress/hooks": "2.9.0",
"@wordpress/html-entities": "2.8.0",
"@wordpress/i18n": "3.14.0",
"@wordpress/icons": "2.3.0",
"@wordpress/is-shallow-equal": "2.1.0",
"@wordpress/keyboard-shortcuts": "1.8.0",
"@wordpress/keycodes": "2.14.0",
"@wordpress/list-reusable-blocks": "1.20.0",
"@wordpress/media-utils": "1.14.0",
"@wordpress/notices": "2.7.0",
"@wordpress/nux": "3.19.0",
"@wordpress/plugins": "2.19.0",
"@wordpress/primitives": "1.6.0",
"@wordpress/priority-queue": "1.7.0",
"@wordpress/redux-routine": "3.10.0",
"@wordpress/rich-text": "3.19.0",
"@wordpress/server-side-render": "1.15.0",
"@wordpress/shortcode": "2.9.0",
"@wordpress/token-list": "1.11.0",
"@wordpress/url": "2.17.0",
"@wordpress/viewport": "2.20.0",
"@wordpress/warning": "1.2.0",
"@wordpress/wordcount": "2.10.0",
"backbone": "1.4.0",
"clipboard": "2.0.6",
"core-js-url-browser": "3.6.4",

View File

@ -2179,33 +2179,33 @@ function use_block_editor_for_post_type( $post_type ) {
function get_block_categories( $post ) {
$default_categories = array(
array(
'slug' => 'common',
'title' => __( 'Common Blocks' ),
'slug' => 'text',
'title' => _x( 'Text', 'block category' ),
'icon' => null,
),
array(
'slug' => 'formatting',
'title' => __( 'Formatting' ),
'slug' => 'media',
'title' => _x( 'Media', 'block category' ),
'icon' => null,
),
array(
'slug' => 'layout',
'title' => __( 'Layout Elements' ),
'slug' => 'design',
'title' => _x( 'Design', 'block category' ),
'icon' => null,
),
array(
'slug' => 'widgets',
'title' => __( 'Widgets' ),
'title' => _x( 'Widgets', 'block category' ),
'icon' => null,
),
array(
'slug' => 'embed',
'title' => __( 'Embeds' ),
'title' => _x( 'Embeds', 'block category' ),
'icon' => null,
),
array(
'slug' => 'reusable',
'title' => __( 'Reusable Blocks' ),
'title' => _x( 'Reusable Blocks', 'block category' ),
'icon' => null,
),
);

View File

@ -116,26 +116,9 @@ function render_block_core_archives( $attributes ) {
* Register archives block.
*/
function register_block_core_archives() {
register_block_type(
'core/archives',
register_block_type_from_metadata(
__DIR__ . '/archives',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'displayAsDropdown' => array(
'type' => 'boolean',
'default' => false,
),
'showPostCounts' => array(
'type' => 'boolean',
'default' => false,
),
),
'render_callback' => 'render_block_core_archives',
)
);

View File

@ -33,14 +33,9 @@ function render_block_core_block( $attributes ) {
* Registers the `core/block` block.
*/
function register_block_core_block() {
register_block_type(
'core/block',
register_block_type_from_metadata(
__DIR__ . '/block',
array(
'attributes' => array(
'ref' => array(
'type' => 'number',
),
),
'render_callback' => 'render_block_core_block',
)
);

View File

@ -52,24 +52,9 @@ function render_block_core_calendar( $attributes ) {
* Registers the `core/calendar` block on server.
*/
function register_block_core_calendar() {
register_block_type(
'core/calendar',
register_block_type_from_metadata(
__DIR__ . '/calendar',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'month' => array(
'type' => 'integer',
),
'year' => array(
'type' => 'integer',
),
),
'render_callback' => 'render_block_core_calendar',
)
);

View File

@ -89,30 +89,9 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
* Registers the `core/categories` block on server.
*/
function register_block_core_categories() {
register_block_type(
'core/categories',
register_block_type_from_metadata(
__DIR__ . '/categories',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'displayAsDropdown' => array(
'type' => 'boolean',
'default' => false,
),
'showHierarchy' => array(
'type' => 'boolean',
'default' => false,
),
'showPostCounts' => array(
'type' => 'boolean',
'default' => false,
),
),
'render_callback' => 'render_block_core_categories',
)
);

View File

@ -152,42 +152,9 @@ function render_block_core_latest_comments( $attributes = array() ) {
* Registers the `core/latest-comments` block.
*/
function register_block_core_latest_comments() {
register_block_type(
'core/latest-comments',
register_block_type_from_metadata(
__DIR__ . '/latest-comments',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array(
'left',
'center',
'right',
'wide',
'full',
),
),
'className' => array(
'type' => 'string',
),
'commentsToShow' => array(
'type' => 'number',
'default' => 5,
'minimum' => 1,
'maximum' => 100,
),
'displayAvatar' => array(
'type' => 'boolean',
'default' => true,
),
'displayDate' => array(
'type' => 'boolean',
'default' => true,
),
'displayExcerpt' => array(
'type' => 'boolean',
'default' => true,
),
),
'render_callback' => 'render_block_core_latest_comments',
)
);

View File

@ -33,7 +33,7 @@ function block_core_latest_posts_get_excerpt_length() {
* @return string Returns the post content with latest posts added.
*/
function render_block_core_latest_posts( $attributes ) {
global $block_core_latest_posts_excerpt_length;
global $post, $block_core_latest_posts_excerpt_length;
$args = array(
'posts_per_page' => $attributes['postsToShow'],
@ -47,7 +47,10 @@ function render_block_core_latest_posts( $attributes ) {
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
if ( isset( $attributes['categories'] ) ) {
$args['category'] = $attributes['categories'];
$args['category__in'] = array_column( $attributes['categories'], 'id' );
}
if ( isset( $attributes['selectedAuthor'] ) ) {
$args['author'] = $attributes['selectedAuthor'];
}
$recent_posts = get_posts( $args );
@ -55,6 +58,7 @@ function render_block_core_latest_posts( $attributes ) {
$list_items_markup = '';
foreach ( $recent_posts as $post ) {
$list_items_markup .= '<li>';
if ( $attributes['displayFeaturedImage'] && has_post_thumbnail( $post ) ) {
@ -94,6 +98,20 @@ function render_block_core_latest_posts( $attributes ) {
$title
);
if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) {
$author_display_name = get_the_author_meta( 'display_name', $post->post_author );
/* translators: byline. %s: current author. */
$byline = sprintf( __( 'by %s' ), $author_display_name );
if ( ! empty( $author_display_name ) ) {
$list_items_markup .= sprintf(
'<div class="wp-block-latest-posts__post-author">%1$s</div>',
esc_html( $byline )
);
}
}
if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) {
$list_items_markup .= sprintf(
'<time datetime="%1$s" class="wp-block-latest-posts__post-date">%2$s</time>',
@ -108,21 +126,9 @@ function render_block_core_latest_posts( $attributes ) {
$trimmed_excerpt = get_the_excerpt( $post );
$list_items_markup .= sprintf(
'<div class="wp-block-latest-posts__post-excerpt">%1$s',
'<div class="wp-block-latest-posts__post-excerpt">%1$s</div>',
$trimmed_excerpt
);
if ( strpos( $trimmed_excerpt, ' &hellip; ' ) !== false ) {
$list_items_markup .= sprintf(
'<a href="%1$s">%2$s</a></div>',
esc_url( get_permalink( $post ) ),
__( 'Read more' )
);
} else {
$list_items_markup .= sprintf(
'</div>'
);
}
}
if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
@ -155,6 +161,10 @@ function render_block_core_latest_posts( $attributes ) {
$class .= ' has-dates';
}
if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) {
$class .= ' has-author';
}
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
@ -170,79 +180,42 @@ function render_block_core_latest_posts( $attributes ) {
* Registers the `core/latest-posts` block on server.
*/
function register_block_core_latest_posts() {
register_block_type(
'core/latest-posts',
register_block_type_from_metadata(
__DIR__ . '/latest-posts',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'categories' => array(
'type' => 'string',
),
'postsToShow' => array(
'type' => 'number',
'default' => 5,
),
'displayPostContent' => array(
'type' => 'boolean',
'default' => false,
),
'displayPostContentRadio' => array(
'type' => 'string',
'default' => 'excerpt',
),
'excerptLength' => array(
'type' => 'number',
'default' => 55,
),
'displayPostDate' => array(
'type' => 'boolean',
'default' => false,
),
'postLayout' => array(
'type' => 'string',
'default' => 'list',
),
'columns' => array(
'type' => 'number',
'default' => 3,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'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',
)
);
}
add_action( 'init', 'register_block_core_latest_posts' );
/**
* Handles outdated versions of the `core/latest-posts` block by converting
* attribute `categories` from a numeric string to an array with key `id`.
*
* This is done to accommodate the changes introduced in #20781 that sought to
* add support for multiple categories to the block. However, given that this
* block is dynamic, the usual provisions for block migration are insufficient,
* as they only act when a block is loaded in the editor.
*
* TODO: Remove when and if the bottom client-side deprecation for this block
* is removed.
*
* @param array $block A single parsed block object.
*
* @return array The migrated block object.
*/
function block_core_latest_posts_migrate_categories( $block ) {
if (
'core/latest-posts' === $block['blockName'] &&
! empty( $block['attrs']['categories'] ) &&
is_string( $block['attrs']['categories'] )
) {
$block['attrs']['categories'] = array(
array( 'id' => absint( $block['attrs']['categories'] ) ),
);
}
return $block;
}
add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' );

View File

@ -92,57 +92,16 @@ function render_block_core_rss( $attributes ) {
$class .= ' ' . $attributes['className'];
}
return sprintf( "<ul class='%s'>%s</ul>", esc_attr( $class ), $list_items );
return sprintf( '<ul class="%s">%s</ul>', esc_attr( $class ), $list_items );
}
/**
* Registers the `core/rss` block on server.
*/
function register_block_core_rss() {
register_block_type(
'core/rss',
register_block_type_from_metadata(
__DIR__ . '/rss',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'columns' => array(
'type' => 'number',
'default' => 2,
),
'blockLayout' => array(
'type' => 'string',
'default' => 'list',
),
'feedURL' => array(
'type' => 'string',
'default' => '',
),
'itemsToShow' => array(
'type' => 'number',
'default' => 5,
),
'displayExcerpt' => array(
'type' => 'boolean',
'default' => false,
),
'displayAuthor' => array(
'type' => 'boolean',
'default' => false,
),
'displayDate' => array(
'type' => 'boolean',
'default' => false,
),
'excerptLength' => array(
'type' => 'number',
'default' => 55,
),
),
'render_callback' => 'render_block_core_rss',
)
);

View File

@ -67,30 +67,9 @@ function render_block_core_search( $attributes ) {
* Registers the `core/search` block on the server.
*/
function register_block_core_search() {
register_block_type(
'core/search',
register_block_type_from_metadata(
__DIR__ . '/search',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'label' => array(
'type' => 'string',
'default' => __( 'Search' ),
),
'placeholder' => array(
'type' => 'string',
'default' => '',
),
'buttonText' => array(
'type' => 'string',
'default' => __( 'Search' ),
),
),
'render_callback' => 'render_block_core_search',
)
);

View File

@ -21,15 +21,10 @@ function render_block_core_shortcode( $attributes, $content ) {
* Registers the `core/shortcode` block on server.
*/
function register_block_core_shortcode() {
$path = __DIR__ . '/shortcode/block.json';
$metadata = json_decode( file_get_contents( $path ), true );
register_block_type(
$metadata['name'],
array_merge(
$metadata,
array(
'render_callback' => 'render_block_core_shortcode',
)
register_block_type_from_metadata(
__DIR__ . '/shortcode',
array(
'render_callback' => 'render_block_core_shortcode',
)
);
}

View File

@ -13,12 +13,9 @@
* @return string Rendered HTML of the referenced block.
*/
function render_block_core_social_link( $attributes ) {
$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
$label = ( isset( $attributes['label'] ) ) ?
$attributes['label'] :
/* translators: %s: Social Link service name */
sprintf( __( 'Link to %s' ), block_core_social_link_get_name( $service ) );
$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
$class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;
// Don't render a link if there is no URL set.
@ -34,16 +31,10 @@ function render_block_core_social_link( $attributes ) {
* Registers the `core/social-link` blocks.
*/
function register_block_core_social_link() {
$path = __DIR__ . '/social-link/block.json';
$metadata = json_decode( file_get_contents( $path ), true );
register_block_type(
$metadata['name'],
array_merge(
$metadata,
array(
'render_callback' => 'render_block_core_social_link',
)
register_block_type_from_metadata(
__DIR__ . '/social-link',
array(
'render_callback' => 'render_block_core_social_link',
)
);
}
@ -218,7 +209,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
),
'tumblr' => array(
'name' => 'Tumblr',
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" focusable="false"><path d="M16.749,17.396c-0.357,0.17-1.041,0.319-1.551,0.332c-1.539,0.041-1.837-1.081-1.85-1.896V9.847h3.861V6.937h-3.847V2.039 c0,0-2.77,0-2.817,0c-0.046,0-0.127,0.041-0.138,0.144c-0.165,1.499-0.867,4.13-3.783,5.181v2.484h1.945v6.282 c0,2.151,1.587,5.206,5.775,5.135c1.413-0.024,2.982-0.616,3.329-1.126L16.749,17.396z"></path></svg>',
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z" /></path></svg>',
),
'twitch' => array(
'name' => 'Twitch',
@ -250,7 +241,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
),
'share' => array(
'name' => 'Share Icon',
'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" role="img" aria-hidden="true" focusable="false"><rect x="0" fill="none" width="20" height="20"/><g><path d="M14.5 12c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.24.03-.46.09-.69l-4.38-2.3c-.55.61-1.33.99-2.21.99-1.66 0-3-1.34-3-3s1.34-3 3-3c.88 0 1.66.39 2.21.99l4.38-2.3c-.06-.23-.09-.45-.09-.69 0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-.88 0-1.66-.39-2.21-.99l-4.38 2.3c.06.23.09.45.09.69s-.03.46-.09.69l4.38 2.3c.55-.61 1.33-.99 2.21-.99z"/></g></svg>',
'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 11.8l6.1-4.5c.1.4.4.7.9.7h2c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-2c-.6 0-1 .4-1 1v.4l-6.4 4.8c-.2-.1-.4-.2-.6-.2H6c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2c.2 0 .4-.1.6-.2l6.4 4.8v.4c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-2c-.5 0-.8.3-.9.7L9 12.2v-.4z"/></svg>',
),
);

View File

@ -51,26 +51,9 @@ function render_block_core_tag_cloud( $attributes ) {
* Registers the `core/tag-cloud` block on server.
*/
function register_block_core_tag_cloud() {
register_block_type(
'core/tag-cloud',
register_block_type_from_metadata(
__DIR__ . '/tag-cloud',
array(
'attributes' => array(
'align' => array(
'type' => 'string',
'enum' => array( 'left', 'center', 'right', 'wide', 'full' ),
),
'className' => array(
'type' => 'string',
),
'taxonomy' => array(
'type' => 'string',
'default' => 'post_tag',
),
'showTagCounts' => array(
'type' => 'boolean',
'default' => false,
),
),
'render_callback' => 'render_block_core_tag_cloud',
)
);

View File

@ -1,9 +1,17 @@
const dotenv = require( 'dotenv' );
const dotenv_expand = require( 'dotenv-expand' );
const { sync: spawn } = require( 'cross-spawn' );
const { execSync } = require( 'child_process' );
// WP_BASE_URL interpolates LOCAL_PORT, so needs to be parsed by dotenv_expand().
dotenv_expand( dotenv.config() );
const result = spawn( 'node', [ require.resolve( 'puppeteer/install' ) ], {
stdio: 'inherit',
} );
if ( result.status > 0 ) {
process.exit( result.status );
}
// Run the tests, passing additional arguments through to the test script.
execSync( 'wp-scripts test-e2e --config tests/e2e/jest.config.js ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );

View File

@ -720,6 +720,14 @@ JS;
$expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js\"></scr' + 'ipt>' );( window.DOMRect ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js\"></scr' + 'ipt>' );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-url.min.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js\"></scr' + 'ipt>' );\n";
$expected .= "</script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready.min.js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n.min.js'></script>\n";
$expected .= "<script type='text/javascript'>\n";
$expected .= "( function( domain, translations ) {\n";
$expected .= " var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;\n";
$expected .= " localeData[\"\"].domain = domain;\n";
$expected .= " wp.i18n.setLocaleData( localeData, domain );\n";
$expected .= "} )( \"default\", { \"locale_data\": { \"messages\": { \"\": {} } } } );\n";
$expected .= "</script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/a11y.min.js'></script>\n";
$expected .= "<script type='text/javascript' src='http://example2.com'></script>\n";
$expected .= "<script type='text/javascript'>\nconsole.log(\"after\");\n</script>\n";

File diff suppressed because one or more lines are too long