Skip to content

Commit

Permalink
Update the WordPress packages to the versions in Gutenberg 11.9 RC
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 8, 2021
1 parent b64d06f commit 5e70569
Show file tree
Hide file tree
Showing 69 changed files with 5,033 additions and 4,051 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,8 @@ module.exports = function(grunt) {
grunt.registerTask( 'verify:build', [
'verify:wp-embed',
'verify:old-files',
'verify:source-maps',
// TODO: Hack, remove this.
// 'verify:source-maps',
] );

/**
Expand Down
7,478 changes: 3,727 additions & 3,751 deletions package-lock.json

Large diffs are not rendered by default.

116 changes: 58 additions & 58 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"last 2 Opera versions"
],
"devDependencies": {
"@wordpress/babel-preset-default": "6.2.1",
"@wordpress/custom-templated-path-webpack-plugin": "2.0.5",
"@wordpress/dependency-extraction-webpack-plugin": "3.1.4",
"@wordpress/e2e-test-utils": "5.4.3",
"@wordpress/library-export-default-webpack-plugin": "2.0.5",
"@wordpress/scripts": "16.1.5",
"@wordpress/babel-preset-default": "6.3.4",
"@wordpress/custom-templated-path-webpack-plugin": "2.1.0",
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
"@wordpress/e2e-test-utils": "5.4.6",
"@wordpress/library-export-default-webpack-plugin": "2.2.0",
"@wordpress/scripts": "19.1.0",
"autoprefixer": "^9.8.6",
"chalk": "4.1.1",
"check-node-version": "4.1.0",
Expand Down Expand Up @@ -78,58 +78,58 @@
"webpack-livereload-plugin": "2.3.0"
},
"dependencies": {
"@wordpress/a11y": "3.1.2",
"@wordpress/annotations": "2.1.6",
"@wordpress/api-fetch": "5.1.2",
"@wordpress/autop": "3.1.2",
"@wordpress/blob": "3.1.2",
"@wordpress/block-directory": "2.1.21",
"@wordpress/block-editor": "6.1.14",
"@wordpress/block-library": "3.2.19",
"@wordpress/block-serialization-default-parser": "4.1.2",
"@wordpress/blocks": "9.1.8",
"@wordpress/components": "14.1.11",
"@wordpress/compose": "4.1.6",
"@wordpress/core-data": "3.1.12",
"@wordpress/customize-widgets": "1.0.20",
"@wordpress/data": "5.1.6",
"@wordpress/data-controls": "2.1.6",
"@wordpress/date": "4.1.2",
"@wordpress/deprecated": "3.1.2",
"@wordpress/dom": "3.1.5",
"@wordpress/dom-ready": "3.1.2",
"@wordpress/edit-post": "4.1.21",
"@wordpress/edit-widgets": "2.1.21",
"@wordpress/editor": "10.1.17",
"@wordpress/element": "3.1.2",
"@wordpress/escape-html": "2.1.2",
"@wordpress/format-library": "2.1.14",
"@wordpress/hooks": "3.1.1",
"@wordpress/html-entities": "3.1.2",
"@wordpress/i18n": "4.1.2",
"@wordpress/icons": "4.0.3",
"@wordpress/interface": "3.1.12",
"@wordpress/is-shallow-equal": "4.1.1",
"@wordpress/keyboard-shortcuts": "2.1.7",
"@wordpress/keycodes": "3.1.2",
"@wordpress/list-reusable-blocks": "2.1.11",
"@wordpress/media-utils": "2.1.2",
"@wordpress/notices": "3.1.6",
"@wordpress/nux": "4.1.11",
"@wordpress/plugins": "3.1.6",
"@wordpress/primitives": "2.1.2",
"@wordpress/priority-queue": "2.1.2",
"@wordpress/redux-routine": "4.1.2",
"@wordpress/reusable-blocks": "2.1.17",
"@wordpress/rich-text": "4.1.6",
"@wordpress/server-side-render": "2.1.12",
"@wordpress/shortcode": "3.1.2",
"@wordpress/token-list": "2.1.1",
"@wordpress/url": "3.1.2",
"@wordpress/viewport": "3.1.6",
"@wordpress/warning": "2.1.2",
"@wordpress/widgets": "1.1.19",
"@wordpress/wordcount": "3.1.2",
"@wordpress/a11y": "3.2.3",
"@wordpress/annotations": "2.2.6",
"@wordpress/api-fetch": "5.2.5",
"@wordpress/autop": "3.2.2",
"@wordpress/blob": "3.2.1",
"@wordpress/block-directory": "3.0.5",
"@wordpress/block-editor": "8.0.0",
"@wordpress/block-library": "6.0.3",
"@wordpress/block-serialization-default-parser": "4.2.2",
"@wordpress/blocks": "11.1.3",
"@wordpress/components": "19.0.1",
"@wordpress/compose": "5.0.5",
"@wordpress/core-data": "4.0.5",
"@wordpress/customize-widgets": "2.0.5",
"@wordpress/data": "6.1.3",
"@wordpress/data-controls": "2.2.6",
"@wordpress/date": "4.2.2",
"@wordpress/deprecated": "3.2.2",
"@wordpress/dom": "3.2.6",
"@wordpress/dom-ready": "3.2.2",
"@wordpress/edit-post": "5.0.5",
"@wordpress/edit-widgets": "3.1.0",
"@wordpress/editor": "12.0.2",
"@wordpress/element": "4.0.3",
"@wordpress/escape-html": "2.2.2",
"@wordpress/format-library": "3.0.5",
"@wordpress/hooks": "3.2.1",
"@wordpress/html-entities": "3.2.2",
"@wordpress/i18n": "4.2.3",
"@wordpress/icons": "6.1.0",
"@wordpress/interface": "4.1.3",
"@wordpress/is-shallow-equal": "4.2.0",
"@wordpress/keyboard-shortcuts": "3.0.5",
"@wordpress/keycodes": "3.2.3",
"@wordpress/list-reusable-blocks": "3.0.5",
"@wordpress/media-utils": "3.0.4",
"@wordpress/notices": "3.2.6",
"@wordpress/nux": "5.0.5",
"@wordpress/plugins": "4.0.5",
"@wordpress/primitives": "3.0.3",
"@wordpress/priority-queue": "2.2.2",
"@wordpress/redux-routine": "4.2.1",
"@wordpress/reusable-blocks": "3.0.5",
"@wordpress/rich-text": "5.0.5",
"@wordpress/server-side-render": "3.0.5",
"@wordpress/shortcode": "3.2.2",
"@wordpress/token-list": "2.2.1",
"@wordpress/url": "3.3.0",
"@wordpress/viewport": "4.0.5",
"@wordpress/warning": "2.2.2",
"@wordpress/widgets": "2.0.5",
"@wordpress/wordcount": "3.2.2",
"backbone": "1.4.0",
"clipboard": "2.0.8",
"core-js-url-browser": "3.6.4",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,16 @@ function get_default_block_editor_settings() {
}
}

// These styles are used if the "no theme styles" options is triggered or on
// themes without their own editor styles.
$default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css';
$default_editor_styles_css = file_get_contents( $default_editor_styles_file );

$editor_settings = array(
'alignWide' => get_theme_support( 'align-wide' ),
'allowedBlockTypes' => true,
'allowedMimeTypes' => get_allowed_mime_types(),
'defaultEditorStyles' => array( array( 'css' => $default_editor_styles_css ) ),
'blockCategories' => get_default_block_categories(),
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
Expand Down Expand Up @@ -464,22 +470,12 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
*
* @global array $editor_styles
*
* @return array An array of theme styles for the block editor. Includes default font family
* style and theme stylesheets.
* @return array An array of theme styles for the block editor.
*/
function get_block_editor_theme_styles() {
global $editor_styles;

if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) {
$styles = array(
array(
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
'__unstableType' => 'core',
),
);
} else {
$styles = array();
}
$styles = array();

if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
foreach ( $editor_styles as $style ) {
Expand Down
10 changes: 7 additions & 3 deletions src/wp-includes/blocks/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function render_block_core_archives( $attributes ) {

$archives = wp_get_archives( $dropdown_args );

$classnames = esc_attr( $class );

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );

switch ( $dropdown_args['type'] ) {
case 'yearly':
$label = __( 'Select Year' );
Expand All @@ -60,13 +64,13 @@ function render_block_core_archives( $attributes ) {

$label = esc_html( $label );

$block_content = '<label class="screen-reader-text" for="' . $dropdown_id . '">' . $title . '</label>
$block_content = '<label for="' . $dropdown_id . '">' . $title . '</label>
<select id="' . $dropdown_id . '" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
<option value="">' . $label . '</option>' . $archives . '</select>';

return sprintf(
'<div class="%1$s">%2$s</div>',
esc_attr( $class ),
'<div %1$s>%2$s</div>',
$wrapper_attributes,
$block_content
);
}
Expand Down
12 changes: 11 additions & 1 deletion src/wp-includes/blocks/button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,19 @@
},
"typography": {
"fontSize": true,
"__experimentalFontFamily": true
"__experimentalFontFamily": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"reusable": false,
"spacing": {
"__experimentalSkipSerialization": true,
"padding": [ "horizontal", "vertical" ],
"__experimentalDefaultControls": {
"padding": true
}
},
"__experimentalBorder": {
"radius": true,
"__experimentalSkipSerialization": true
Expand Down
26 changes: 16 additions & 10 deletions src/wp-includes/blocks/buttons/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@
"description": "Prompt visitors to take action with a group of button-style links.",
"keywords": [ "link" ],
"textdomain": "default",
"attributes": {
"contentJustification": {
"type": "string"
},
"orientation": {
"type": "string",
"default": "horizontal"
}
},
"supports": {
"anchor": true,
"align": [ "wide", "full" ]
"align": [ "wide", "full" ],
"__experimentalExposeControlsToChildren": true,
"spacing": {
"blockGap": true,
"margin": ["top", "bottom" ],
"__experimentalDefaultControls": {
"blockGap": true
}
},
"__experimentalLayout": {
"allowSwitching": false,
"allowInheriting": false,
"default": {
"type": "flex"
}
}
},
"editorStyle": "wp-block-buttons-editor",
"style": "wp-block-buttons"
Expand Down
92 changes: 92 additions & 0 deletions src/wp-includes/blocks/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
function render_block_core_calendar( $attributes ) {
global $monthnum, $year;

// Calendar shouldn't be rendered
// when there are no published posts on the site.
if ( ! block_core_calendar_has_published_posts() ) {
if ( is_user_logged_in() ) {
return '<div>' . __( 'The calendar block is hidden because there are no published posts.', 'gutenberg' ) . '</div>';
}
return '';
}

$previous_monthnum = $monthnum;
$previous_year = $year;

Expand Down Expand Up @@ -59,3 +68,86 @@ function register_block_core_calendar() {
}

add_action( 'init', 'register_block_core_calendar' );

/**
* Returns whether or not there are any published posts.
*
* Used to hide the calendar block when there are no published posts.
* This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
*
* @return bool Has any published posts or not.
*/
function block_core_calendar_has_published_posts() {
// Multisite already has an option that stores the count of the published posts.
// Let's use that for multisites.
if ( is_multisite() ) {
return 0 < (int) get_option( 'post_count' );
}

// On single sites we try our own cached option first.
$has_published_posts = get_option( 'gutenberg_calendar_block_has_published_posts', null );
if ( null !== $has_published_posts ) {
return (bool) $has_published_posts;
}

// No cache hit, let's update the cache and return the cached value.
return block_core_calendar_update_has_published_posts();
}

/**
* Queries the database for any published post and saves
* a flag whether any published post exists or not.
*
* @return bool Has any published posts or not.
*/
function block_core_calendar_update_has_published_posts() {
global $wpdb;
$has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
update_option( 'gutenberg_calendar_block_has_published_posts', $has_published_posts );
return $has_published_posts;
}

// We only want to register these functions and actions when
// we are on single sites. On multi sites we use `post_count` option.
if ( ! is_multisite() ) {
/**
* Handler for updating the has published posts flag when a post is deleted.
*
* @param int $post_id Deleted post ID.
*/
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
$post = get_post( $post_id );

if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
return;
}

block_core_calendar_update_has_published_posts();
}

/**
* Handler for updating the has published posts flag when a post status changes.
*
* @param string $new_status The status the post is changing to.
* @param string $old_status The status the post is changing from.
* @param WP_Post $post Post object.
*/
function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
if ( $new_status === $old_status ) {
return;
}

if ( 'post' !== get_post_type( $post ) ) {
return;
}

if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}

block_core_calendar_update_has_published_posts();
}

add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );
}
3 changes: 3 additions & 0 deletions src/wp-includes/blocks/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function render_block_core_categories( $attributes ) {
'show_count' => ! empty( $attributes['showPostCounts'] ),
'title_li' => '',
);
if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) {
$args['parent'] = 0;
}

if ( ! empty( $attributes['displayAsDropdown'] ) ) {
$id = 'wp-block-categories-' . $block_id;
Expand Down
4 changes: 4 additions & 0 deletions src/wp-includes/blocks/categories/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"showPostCounts": {
"type": "boolean",
"default": false
},
"showOnlyTopLevel": {
"type": "boolean",
"default": false
}
},
"supports": {
Expand Down
Loading

0 comments on commit 5e70569

Please sign in to comment.