Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.

- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.

Merges [43891], [43903], and [43919] to trunk.

Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.

git-svn-id: https://develop.svn.wordpress.org/trunk@44262 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2018-12-17 15:35:21 +00:00
parent 572207384b
commit 7a20625cf0
9 changed files with 371 additions and 729 deletions

932
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -56,41 +56,41 @@
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@wordpress/a11y": "^2.0.2",
"@wordpress/annotations": "^1.0.0",
"@wordpress/api-fetch": "^2.2.3",
"@wordpress/annotations": "^1.0.3",
"@wordpress/api-fetch": "^2.2.5",
"@wordpress/autop": "^2.0.2",
"@wordpress/blob": "^2.1.0",
"@wordpress/block-library": "^2.2.2",
"@wordpress/block-library": "^2.2.6",
"@wordpress/block-serialization-default-parser": "^2.0.0",
"@wordpress/blocks": "^5.3.1",
"@wordpress/components": "^6.0.0",
"@wordpress/compose": "^2.1.2",
"@wordpress/core-data": "^2.0.12",
"@wordpress/data": "^3.1.2",
"@wordpress/date": "^2.2.1",
"@wordpress/blocks": "^6.0.2",
"@wordpress/components": "^7.0.1",
"@wordpress/compose": "^3.0.0",
"@wordpress/core-data": "^2.0.14",
"@wordpress/data": "^4.0.1",
"@wordpress/date": "^3.0.0",
"@wordpress/deprecated": "^2.0.3",
"@wordpress/dom": "^2.0.6",
"@wordpress/dom": "^2.0.7",
"@wordpress/dom-ready": "^2.0.2",
"@wordpress/edit-post": "^3.0.0",
"@wordpress/editor": "^7.0.0",
"@wordpress/element": "^2.1.7",
"@wordpress/edit-post": "^3.1.1",
"@wordpress/editor": "^9.0.1",
"@wordpress/element": "^2.1.8",
"@wordpress/escape-html": "^1.0.1",
"@wordpress/format-library": "^1.2.0",
"@wordpress/format-library": "^1.2.4",
"@wordpress/hooks": "^2.0.3",
"@wordpress/html-entities": "^2.0.2",
"@wordpress/i18n": "^3.0.1",
"@wordpress/html-entities": "^2.0.3",
"@wordpress/i18n": "^3.1.0",
"@wordpress/is-shallow-equal": "^1.1.4",
"@wordpress/keycodes": "^2.0.3",
"@wordpress/list-reusable-blocks": "^1.1.10",
"@wordpress/notices": "^1.0.4",
"@wordpress/nux": "^2.0.12",
"@wordpress/plugins": "^2.0.8",
"@wordpress/keycodes": "^2.0.5",
"@wordpress/list-reusable-blocks": "^1.1.14",
"@wordpress/notices": "^1.1.0",
"@wordpress/nux": "^3.0.2",
"@wordpress/plugins": "^2.0.9",
"@wordpress/redux-routine": "^3.0.3",
"@wordpress/rich-text": "^2.0.4",
"@wordpress/rich-text": "^3.0.2",
"@wordpress/shortcode": "^2.0.2",
"@wordpress/token-list": "^1.0.2",
"@wordpress/url": "^2.3.0",
"@wordpress/viewport": "^2.0.10",
"@wordpress/token-list": "^1.1.0",
"@wordpress/url": "^2.3.1",
"@wordpress/viewport": "^2.0.12",
"@wordpress/wordcount": "^2.0.3",
"backbone": "1.3.3",
"element-closest": "^2.0.2",
@ -105,8 +105,8 @@
"masonry-layout": "3.3.2",
"moment": "^2.22.2",
"polyfill-library": "^3.26.0-0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"twemoji": "11.0.0",
"underscore": "1.8.3",
"whatwg-fetch": "^3.0.0"

View File

@ -177,6 +177,16 @@ $styles = array(
),
),
);
/*
* Set a locale specific default font.
* Translators: Use this to specify the CSS font family for the default font
*/
$locale_font_family = esc_html_x( 'Noto Serif', 'CSS Font Family for Editor Font' );
$styles[] = array(
'css' => "body { font-family: '$locale_font_family' }",
);
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
foreach ( $editor_styles as $style ) {
if ( preg_match( '~^(https?:)?//~', $style ) ) {

View File

@ -32,7 +32,7 @@ function render_block_core_archives( $attributes ) {
$class .= ' wp-block-archives-dropdown';
$dropdown_id = esc_attr( uniqid( 'wp-block-archives-' ) );
$title = __( 'Archives', 'gutenberg' );
$title = __( 'Archives', 'default' );
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
$dropdown_args = apply_filters(
@ -50,19 +50,19 @@ function render_block_core_archives( $attributes ) {
switch ( $dropdown_args['type'] ) {
case 'yearly':
$label = __( 'Select Year', 'gutenberg' );
$label = __( 'Select Year', 'default' );
break;
case 'monthly':
$label = __( 'Select Month', 'gutenberg' );
$label = __( 'Select Month', 'default' );
break;
case 'daily':
$label = __( 'Select Day', 'gutenberg' );
$label = __( 'Select Day', 'default' );
break;
case 'weekly':
$label = __( 'Select Week', 'gutenberg' );
$label = __( 'Select Week', 'default' );
break;
default:
$label = __( 'Select Post', 'gutenberg' );
$label = __( 'Select Post', 'default' );
break;
}
@ -101,7 +101,7 @@ function render_block_core_archives( $attributes ) {
$block_content = sprintf(
'<div class="%1$s">%2$s</div>',
$classnames,
__( 'No archives to show.', 'gutenberg' )
__( 'No archives to show.', 'default' )
);
} else {

View File

@ -27,7 +27,7 @@ function render_block_core_categories( $attributes ) {
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
$id = 'wp-block-categories-' . $block_id;
$args['id'] = $id;
$args['show_option_none'] = __( 'Select Category', 'gutenberg' );
$args['show_option_none'] = __( 'Select Category', 'default' );
$wrapper_markup = '<div class="%1$s">%2$s</div>';
$items_markup = wp_dropdown_categories( $args );
$type = 'dropdown';

View File

@ -29,7 +29,7 @@ if ( ! function_exists( 'gutenberg_draft_or_post_title' ) ) {
function gutenberg_draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post );
if ( empty( $title ) ) {
$title = __( '(no title)', 'gutenberg' );
$title = __( '(no title)', 'default' );
}
return esc_html( $title );
}
@ -98,7 +98,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
$list_items_markup .= sprintf(
/* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */
__( '%1$s on %2$s', 'gutenberg' ),
__( '%1$s on %2$s', 'default' ),
$author_markup,
$post_title
);
@ -119,7 +119,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
}
$class = 'wp-block-latest-comments';
if ( $attributes['align'] ) {
if ( isset( $attributes['align'] ) ) {
$class .= " align{$attributes['align']}";
}
if ( $attributes['displayAvatar'] ) {
@ -143,7 +143,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
) : sprintf(
'<div class="%1$s">%2$s</div>',
$classnames,
__( 'No comments to show.', 'gutenberg' )
__( 'No comments to show.', 'default' )
);
return $block_content;

View File

@ -13,16 +13,19 @@
* @return string Returns the post content with latest posts added.
*/
function render_block_core_latest_posts( $attributes ) {
$recent_posts = wp_get_recent_posts(
array(
'numberposts' => $attributes['postsToShow'],
'post_status' => 'publish',
'order' => $attributes['order'],
'orderby' => $attributes['orderBy'],
'category' => $attributes['categories'],
)
$args = array(
'numberposts' => $attributes['postsToShow'],
'post_status' => 'publish',
'order' => $attributes['order'],
'orderby' => $attributes['orderBy'],
);
if ( isset( $attributes['categories'] ) ) {
$args['categories'] = $attributes['categories'];
}
$recent_posts = wp_get_recent_posts( $args );
$list_items_markup = '';
foreach ( $recent_posts as $post ) {
@ -30,7 +33,7 @@ function render_block_core_latest_posts( $attributes ) {
$title = get_the_title( $post_id );
if ( ! $title ) {
$title = __( '(Untitled)', 'gutenberg' );
$title = __( '(Untitled)', 'default' );
}
$list_items_markup .= sprintf(
'<li><a href="%1$s">%2$s</a>',

View File

@ -74,10 +74,12 @@ function wp_register_tinymce_scripts( &$scripts, $force_uncompressed = false ) {
* @param WP_Scripts $scripts WP_Scripts object.
*/
function wp_default_packages_vendor( &$scripts ) {
global $wp_locale;
$dev_suffix = wp_scripts_get_suffix( 'dev' );
$vendor_scripts = array(
'react',
'react' => array( 'wp-polyfill' ),
'react-dom' => array( 'react' ),
'moment',
'lodash',
@ -100,9 +102,8 @@ function wp_default_packages_vendor( &$scripts ) {
}
$scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) );
did_action( 'init' ) && $scripts->add_data(
did_action( 'init' ) && $scripts->add_inline_script(
'wp-polyfill',
'data',
wp_get_script_polyfill(
$scripts,
array(
@ -110,11 +111,40 @@ function wp_default_packages_vendor( &$scripts ) {
'document.contains' => 'wp-polyfill-node-contains',
'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
)
),
'after'
)
);
did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
did_action( 'init' ) && $scripts->add_inline_script(
'moment',
sprintf(
"moment.locale( '%s', %s );",
get_user_locale(),
wp_json_encode(
array(
'months' => array_values( $wp_locale->month ),
'monthsShort' => array_values( $wp_locale->month_abbrev ),
'weekdays' => array_values( $wp_locale->weekday ),
'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
'week' => array(
'dow' => (int) get_option( 'start_of_week', 0 ),
),
'longDateFormat' => array(
'LT' => get_option( 'time_format', __( 'g:i a', 'default' ) ),
'LTS' => null,
'L' => null,
'LL' => get_option( 'date_format', __( 'F j, Y', 'default' ) ),
'LLL' => __( 'F j, Y g:i a', 'default' ),
'LLLL' => null,
),
)
)
),
'after'
);
}
/**
@ -183,6 +213,7 @@ function wp_default_packages_scripts( &$scripts ) {
'wp-dom',
'wp-element',
'wp-hooks',
'wp-html-entities',
'wp-i18n',
'wp-is-shallow-equal',
'wp-polyfill',
@ -201,6 +232,7 @@ function wp_default_packages_scripts( &$scripts ) {
'wp-compose',
'wp-core-data',
'wp-data',
'wp-date',
'wp-editor',
'wp-element',
'wp-html-entities',
@ -219,7 +251,6 @@ function wp_default_packages_scripts( &$scripts ) {
'wp-a11y',
'wp-api-fetch',
'wp-compose',
'wp-deprecated',
'wp-dom',
'wp-element',
'wp-hooks',
@ -233,7 +264,6 @@ function wp_default_packages_scripts( &$scripts ) {
),
'compose' => array(
'lodash',
'wp-deprecated',
'wp-element',
'wp-is-shallow-equal',
'wp-polyfill',
@ -242,7 +272,6 @@ function wp_default_packages_scripts( &$scripts ) {
'data' => array(
'lodash',
'wp-compose',
'wp-deprecated',
'wp-element',
'wp-is-shallow-equal',
'wp-polyfill',
@ -272,6 +301,7 @@ function wp_default_packages_scripts( &$scripts ) {
'wp-embed',
'wp-i18n',
'wp-keycodes',
'wp-notices',
'wp-nux',
'wp-plugins',
'wp-polyfill',
@ -344,10 +374,10 @@ function wp_default_packages_scripts( &$scripts ) {
),
'nux' => array(
'wp-element',
'lodash',
'wp-components',
'wp-compose',
'wp-data',
'wp-deprecated',
'wp-i18n',
'wp-polyfill',
'lodash',
@ -356,9 +386,7 @@ function wp_default_packages_scripts( &$scripts ) {
'redux-routine' => array( 'wp-polyfill' ),
'rich-text' => array(
'lodash',
'wp-blocks',
'wp-data',
'wp-deprecated',
'wp-escape-html',
'wp-polyfill',
),
@ -1852,11 +1880,13 @@ function wp_default_styles( &$styles ) {
$fonts_url = '';
/*
* Translators: If there are characters in your language that are not supported
* by Noto Serif, translate this to 'off'. Do not translate into your own language.
* Translators: Use this to specify the proper Google Font name and variants
* to load that is supported by your language. Do not translate.
* Set to 'off' to disable loading.
*/
if ( 'off' !== _x( 'on', 'Noto Serif font: on or off' ) ) {
$fonts_url = 'https://fonts.googleapis.com/css?family=Noto+Serif%3A400%2C400i%2C700%2C700i';
$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
if ( 'off' !== $font_family ) {
$fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
}
$styles->add( 'wp-editor-font', $fonts_url );

View File

@ -225,6 +225,7 @@ module.exports = function( env = { environment: 'production', watch: false, forc
'deprecated',
'dom-ready',
'redux-routine',
'token-list',
].map( camelCaseDash ) ),
new CustomTemplatedPathPlugin( {
basename( path, data ) {