mirror of
git://develop.git.wordpress.org/
synced 2025-04-28 08:02:59 +02:00
Editor: Update npm packages ahead of 6.4 RC1.
Updates the npm packages and code for: * [https://github.com/WordPress/gutenberg/pull/55121 List: fix forward merging of nested list] * [https://github.com/WordPress/gutenberg/pull/55182 Update consent string for using private APIs.] * [https://github.com/WordPress/gutenberg/pull/55204 useBlockSettings: add missing useMemo dependencies] * [https://github.com/WordPress/gutenberg/pull/55120 Remove the lightbox filter and view file when the lightbox setting is disabled.] * [https://github.com/WordPress/gutenberg/pull/55245 Patterns: Remove the version enforcement for npm in engines field] * [https://github.com/WordPress/gutenberg/pull/55237 Remove `@return void` from PHP function docs] * [https://github.com/WordPress/gutenberg/pull/55141 Image: Disable lightbox editor UI for linked images] * [https://github.com/WordPress/gutenberg/pull/55269 Image: Stop crashing with Lightbox on image blocks without an image] * [https://github.com/WordPress/gutenberg/pull/55021 Update fullscreen icon] * [https://github.com/WordPress/gutenberg/pull/55217 Template Part block: Fall back to current theme if no theme attribute is given.] This change is part of fix for a performance regression re-introduced by [56818]. References: * [https://github.com/WordPress/gutenberg/pull/55298 Gutenberg PR 55298] Cherry-pick commits Follow-up to [56818], [56816]. Props ellatrix, peterwilsoncc, jsnajdr, afercia, gziolo, isabel_brison, artemiosans, richtabor, bernhard-reiter, flixos90, mikachan, spacedmonkey, hellofromTonya. See #59583, #59411. git-svn-id: https://develop.svn.wordpress.org/trunk@56849 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
048c80951f
commit
871a496fb4
2847
package-lock.json
generated
2847
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
136
package.json
136
package.json
@ -26,10 +26,10 @@
|
||||
"devDependencies": {
|
||||
"@lodder/grunt-postcss": "^3.1.1",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
||||
"@wordpress/babel-preset-default": "7.26.5",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "4.25.5",
|
||||
"@wordpress/e2e-test-utils": "10.13.5",
|
||||
"@wordpress/scripts": "26.13.5",
|
||||
"@wordpress/babel-preset-default": "7.26.6",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "4.25.6",
|
||||
"@wordpress/e2e-test-utils": "10.13.6",
|
||||
"@wordpress/scripts": "26.13.6",
|
||||
"autoprefixer": "10.4.16",
|
||||
"chalk": "5.3.0",
|
||||
"check-node-version": "4.2.1",
|
||||
@ -78,70 +78,70 @@
|
||||
"dependencies": {
|
||||
"@emotion/is-prop-valid": "0.8.8",
|
||||
"@emotion/memoize": "0.7.4",
|
||||
"@wordpress/a11y": "3.42.5",
|
||||
"@wordpress/annotations": "2.42.5",
|
||||
"@wordpress/api-fetch": "6.39.5",
|
||||
"@wordpress/autop": "3.42.5",
|
||||
"@wordpress/blob": "3.42.5",
|
||||
"@wordpress/block-directory": "4.19.5",
|
||||
"@wordpress/block-editor": "12.10.5",
|
||||
"@wordpress/block-library": "8.19.5",
|
||||
"@wordpress/block-serialization-default-parser": "4.42.5",
|
||||
"@wordpress/blocks": "12.19.5",
|
||||
"@wordpress/commands": "0.13.5",
|
||||
"@wordpress/components": "25.8.5",
|
||||
"@wordpress/compose": "6.19.5",
|
||||
"@wordpress/core-commands": "0.11.5",
|
||||
"@wordpress/core-data": "6.19.5",
|
||||
"@wordpress/customize-widgets": "4.19.5",
|
||||
"@wordpress/data": "9.12.5",
|
||||
"@wordpress/data-controls": "3.11.5",
|
||||
"@wordpress/date": "4.42.5",
|
||||
"@wordpress/deprecated": "3.42.5",
|
||||
"@wordpress/dom": "3.42.5",
|
||||
"@wordpress/dom-ready": "3.42.5",
|
||||
"@wordpress/edit-post": "7.19.5",
|
||||
"@wordpress/edit-site": "5.19.5",
|
||||
"@wordpress/edit-widgets": "5.19.5",
|
||||
"@wordpress/editor": "13.19.5",
|
||||
"@wordpress/element": "5.19.5",
|
||||
"@wordpress/escape-html": "2.42.5",
|
||||
"@wordpress/format-library": "4.19.5",
|
||||
"@wordpress/hooks": "3.42.5",
|
||||
"@wordpress/html-entities": "3.42.5",
|
||||
"@wordpress/i18n": "4.42.5",
|
||||
"@wordpress/icons": "9.33.5",
|
||||
"@wordpress/interactivity": "2.3.5",
|
||||
"@wordpress/interface": "5.19.5",
|
||||
"@wordpress/is-shallow-equal": "4.42.5",
|
||||
"@wordpress/keyboard-shortcuts": "4.19.5",
|
||||
"@wordpress/keycodes": "3.42.5",
|
||||
"@wordpress/list-reusable-blocks": "4.19.5",
|
||||
"@wordpress/media-utils": "4.33.5",
|
||||
"@wordpress/notices": "4.10.5",
|
||||
"@wordpress/nux": "8.4.5",
|
||||
"@wordpress/patterns": "1.3.5",
|
||||
"@wordpress/plugins": "6.10.5",
|
||||
"@wordpress/preferences": "3.19.5",
|
||||
"@wordpress/preferences-persistence": "1.34.5",
|
||||
"@wordpress/primitives": "3.40.5",
|
||||
"@wordpress/priority-queue": "2.42.5",
|
||||
"@wordpress/private-apis": "0.24.5",
|
||||
"@wordpress/redux-routine": "4.42.5",
|
||||
"@wordpress/reusable-blocks": "4.19.5",
|
||||
"@wordpress/rich-text": "6.19.5",
|
||||
"@wordpress/router": "0.11.5",
|
||||
"@wordpress/server-side-render": "4.19.5",
|
||||
"@wordpress/shortcode": "3.42.5",
|
||||
"@wordpress/style-engine": "1.25.5",
|
||||
"@wordpress/sync": "0.4.5",
|
||||
"@wordpress/token-list": "2.42.5",
|
||||
"@wordpress/undo-manager": "0.2.5",
|
||||
"@wordpress/url": "3.43.5",
|
||||
"@wordpress/viewport": "5.19.5",
|
||||
"@wordpress/warning": "2.42.5",
|
||||
"@wordpress/widgets": "3.19.5",
|
||||
"@wordpress/wordcount": "3.42.5",
|
||||
"@wordpress/a11y": "3.42.6",
|
||||
"@wordpress/annotations": "2.42.6",
|
||||
"@wordpress/api-fetch": "6.39.6",
|
||||
"@wordpress/autop": "3.42.6",
|
||||
"@wordpress/blob": "3.42.6",
|
||||
"@wordpress/block-directory": "4.19.6",
|
||||
"@wordpress/block-editor": "12.10.6",
|
||||
"@wordpress/block-library": "8.19.6",
|
||||
"@wordpress/block-serialization-default-parser": "4.42.6",
|
||||
"@wordpress/blocks": "12.19.6",
|
||||
"@wordpress/commands": "0.13.6",
|
||||
"@wordpress/components": "25.8.6",
|
||||
"@wordpress/compose": "6.19.6",
|
||||
"@wordpress/core-commands": "0.11.6",
|
||||
"@wordpress/core-data": "6.19.6",
|
||||
"@wordpress/customize-widgets": "4.19.6",
|
||||
"@wordpress/data": "9.12.6",
|
||||
"@wordpress/data-controls": "3.11.6",
|
||||
"@wordpress/date": "4.42.6",
|
||||
"@wordpress/deprecated": "3.42.6",
|
||||
"@wordpress/dom": "3.42.6",
|
||||
"@wordpress/dom-ready": "3.42.6",
|
||||
"@wordpress/edit-post": "7.19.6",
|
||||
"@wordpress/edit-site": "5.19.6",
|
||||
"@wordpress/edit-widgets": "5.19.6",
|
||||
"@wordpress/editor": "13.19.6",
|
||||
"@wordpress/element": "5.19.6",
|
||||
"@wordpress/escape-html": "2.42.6",
|
||||
"@wordpress/format-library": "4.19.6",
|
||||
"@wordpress/hooks": "3.42.6",
|
||||
"@wordpress/html-entities": "3.42.6",
|
||||
"@wordpress/i18n": "4.42.6",
|
||||
"@wordpress/icons": "9.33.6",
|
||||
"@wordpress/interactivity": "2.3.6",
|
||||
"@wordpress/interface": "5.19.6",
|
||||
"@wordpress/is-shallow-equal": "4.42.6",
|
||||
"@wordpress/keyboard-shortcuts": "4.19.6",
|
||||
"@wordpress/keycodes": "3.42.6",
|
||||
"@wordpress/list-reusable-blocks": "4.19.6",
|
||||
"@wordpress/media-utils": "4.33.6",
|
||||
"@wordpress/notices": "4.10.6",
|
||||
"@wordpress/nux": "8.4.6",
|
||||
"@wordpress/patterns": "1.3.6",
|
||||
"@wordpress/plugins": "6.10.6",
|
||||
"@wordpress/preferences": "3.19.6",
|
||||
"@wordpress/preferences-persistence": "1.34.6",
|
||||
"@wordpress/primitives": "3.40.6",
|
||||
"@wordpress/priority-queue": "2.42.6",
|
||||
"@wordpress/private-apis": "0.24.6",
|
||||
"@wordpress/redux-routine": "4.42.6",
|
||||
"@wordpress/reusable-blocks": "4.19.6",
|
||||
"@wordpress/rich-text": "6.19.6",
|
||||
"@wordpress/router": "0.11.6",
|
||||
"@wordpress/server-side-render": "4.19.6",
|
||||
"@wordpress/shortcode": "3.42.6",
|
||||
"@wordpress/style-engine": "1.25.6",
|
||||
"@wordpress/sync": "0.4.6",
|
||||
"@wordpress/token-list": "2.42.6",
|
||||
"@wordpress/undo-manager": "0.2.6",
|
||||
"@wordpress/url": "3.43.6",
|
||||
"@wordpress/viewport": "5.19.6",
|
||||
"@wordpress/warning": "2.42.6",
|
||||
"@wordpress/widgets": "3.19.6",
|
||||
"@wordpress/wordcount": "3.42.6",
|
||||
"backbone": "1.5.0",
|
||||
"clipboard": "2.0.11",
|
||||
"core-js-url-browser": "3.6.4",
|
||||
|
File diff suppressed because one or more lines are too long
@ -16,11 +16,13 @@
|
||||
* @return string The block content with the data-id attribute added.
|
||||
*/
|
||||
function render_block_core_image( $attributes, $content, $block ) {
|
||||
if ( false === stripos( $content, '<img' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
$processor->next_tag( 'img' );
|
||||
|
||||
if ( $processor->get_attribute( 'src' ) === null ) {
|
||||
if ( ! $processor->next_tag( 'img' ) || null === $processor->get_attribute( 'src' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -32,45 +34,47 @@ function render_block_core_image( $attributes, $content, $block ) {
|
||||
$processor->set_attribute( 'data-id', $attributes['data-id'] );
|
||||
}
|
||||
|
||||
$lightbox_enabled = false;
|
||||
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
||||
$lightbox_settings = block_core_image_get_lightbox_settings( $block->parsed_block );
|
||||
|
||||
// If the lightbox is enabled and the image is not linked, flag the lightbox to be rendered.
|
||||
if ( isset( $lightbox_settings ) && 'none' === $link_destination ) {
|
||||
$view_js_file_handle = 'wp-block-image-view';
|
||||
$script_handles = $block->block_type->view_script_handles;
|
||||
|
||||
if ( isset( $lightbox_settings['enabled'] ) && true === $lightbox_settings['enabled'] ) {
|
||||
$lightbox_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If at least one block in the page has the lightbox, mark the block type as interactive.
|
||||
if ( $lightbox_enabled ) {
|
||||
/*
|
||||
* If the lightbox is enabled and the image is not linked, add the filter
|
||||
* and the JavaScript view file.
|
||||
*/
|
||||
if (
|
||||
isset( $lightbox_settings ) &&
|
||||
'none' === $link_destination &&
|
||||
isset( $lightbox_settings['enabled'] ) &&
|
||||
true === $lightbox_settings['enabled']
|
||||
) {
|
||||
$block->block_type->supports['interactivity'] = true;
|
||||
}
|
||||
|
||||
// Determine whether the view script should be enqueued or not.
|
||||
$view_js_file = 'wp-block-image-view';
|
||||
if ( ! wp_script_is( $view_js_file ) ) {
|
||||
$script_handles = $block->block_type->view_script_handles;
|
||||
|
||||
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
||||
if ( ! $lightbox_enabled && in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
|
||||
if ( ! in_array( $view_js_file_handle, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file_handle ) );
|
||||
}
|
||||
// If the script is needed, but it was previously removed, add it again.
|
||||
if ( $lightbox_enabled && ! in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $lightbox_enabled ) {
|
||||
// This render needs to happen in a filter with priority 15 to ensure that it
|
||||
// runs after the duotone filter and that duotone styles are applied to the image
|
||||
// in the lightbox. We also need to ensure that the lightbox works with any plugins
|
||||
// that might use filters as well. We can consider removing this in the future if the
|
||||
// way the blocks are rendered changes, or if a new kind of filter is introduced.
|
||||
/*
|
||||
* This render needs to happen in a filter with priority 15 to ensure
|
||||
* that it runs after the duotone filter and that duotone styles are
|
||||
* applied to the image in the lightbox. We also need to ensure that the
|
||||
* lightbox works with any plugins that might use filters as well. We
|
||||
* can consider removing this in the future if the way the blocks are
|
||||
* rendered changes, or if a new kind of filter is introduced.
|
||||
*/
|
||||
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
|
||||
} else {
|
||||
/*
|
||||
* Remove the filter and the JavaScript view file if previously added by
|
||||
* other Image blocks.
|
||||
*/
|
||||
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
|
||||
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
||||
if ( in_array( $view_js_file_handle, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file_handle ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $processor->get_updated_html();
|
||||
@ -123,11 +127,28 @@ function block_core_image_get_lightbox_settings( $block ) {
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
function block_core_image_render_lightbox( $block_content, $block ) {
|
||||
/*
|
||||
* If it's not possible that an IMG element exists then return the given
|
||||
* block content as-is. It may be that there's no actual image in the block
|
||||
* or it could be that another plugin already modified this HTML.
|
||||
*/
|
||||
if ( false === stripos( $block_content, '<img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $block_content );
|
||||
|
||||
$aria_label = __( 'Enlarge image' );
|
||||
|
||||
$processor->next_tag( 'img' );
|
||||
/*
|
||||
* If there's definitely no IMG element in the block then return the given
|
||||
* block content as-is. There's nothing that this code can knowingly modify
|
||||
* to add the lightbox behavior.
|
||||
*/
|
||||
if ( ! $processor->next_tag( 'img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$alt_attribute = $processor->get_attribute( 'alt' );
|
||||
|
||||
// An empty alt attribute `alt=""` is valid for decorative images.
|
||||
@ -310,8 +331,6 @@ HTML;
|
||||
* @since 6.4.0
|
||||
*
|
||||
* @global WP_Scripts $wp_scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function block_core_image_ensure_interactivity_dependency() {
|
||||
global $wp_scripts;
|
||||
@ -327,8 +346,6 @@ add_action( 'wp_print_scripts', 'block_core_image_ensure_interactivity_dependenc
|
||||
|
||||
/**
|
||||
* Registers the `core/image` block on server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function register_block_core_image() {
|
||||
register_block_type_from_metadata(
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
/**
|
||||
* Registers the `core/pattern` block on the server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function register_block_core_pattern() {
|
||||
register_block_type_from_metadata(
|
||||
@ -46,7 +44,6 @@ function render_block_core_pattern( $attributes ) {
|
||||
// Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin.
|
||||
// This can be removed when the minimum supported WordPress is >= 6.4.
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) {
|
||||
$content = _inject_theme_attribute_in_block_template_content( $content );
|
||||
$blocks = parse_blocks( $content );
|
||||
$content = gutenberg_serialize_blocks( $blocks );
|
||||
}
|
||||
|
@ -281,8 +281,6 @@ function classnames_for_block_core_search( $attributes ) {
|
||||
* @param array $wrapper_styles Current collection of wrapper styles.
|
||||
* @param array $button_styles Current collection of button styles.
|
||||
* @param array $input_styles Current collection of input styles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
||||
$is_button_inside = isset( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition'];
|
||||
@ -327,8 +325,6 @@ function apply_block_core_search_border_style( $attributes, $property, $side, &$
|
||||
* @param array $wrapper_styles Current collection of wrapper styles.
|
||||
* @param array $button_styles Current collection of button styles.
|
||||
* @param array $input_styles Current collection of input styles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function apply_block_core_search_border_styles( $attributes, $property, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
||||
apply_block_core_search_border_style( $attributes, $property, null, $wrapper_styles, $button_styles, $input_styles );
|
||||
|
@ -18,13 +18,10 @@ function render_block_core_template_part( $attributes ) {
|
||||
$template_part_id = null;
|
||||
$content = null;
|
||||
$area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
|
||||
$theme = isset( $attributes['theme'] ) ? $attributes['theme'] : get_stylesheet();
|
||||
|
||||
if (
|
||||
isset( $attributes['slug'] ) &&
|
||||
isset( $attributes['theme'] ) &&
|
||||
get_stylesheet() === $attributes['theme']
|
||||
) {
|
||||
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
|
||||
if ( isset( $attributes['slug'] ) && get_stylesheet() === $theme ) {
|
||||
$template_part_id = $theme . '//' . $attributes['slug'];
|
||||
$template_part_query = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'wp_template_part',
|
||||
@ -34,7 +31,7 @@ function render_block_core_template_part( $attributes ) {
|
||||
array(
|
||||
'taxonomy' => 'wp_theme',
|
||||
'field' => 'name',
|
||||
'terms' => $attributes['theme'],
|
||||
'terms' => $theme,
|
||||
),
|
||||
),
|
||||
'posts_per_page' => 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user