Skip to content

Commit

Permalink
Update the minimum version and the tested up to flag of the Gutenberg…
Browse files Browse the repository at this point in the history
… plugin (#24693)
  • Loading branch information
youknowriad authored Aug 24, 2020
1 parent aed8fa7 commit 0679889
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 130 deletions.
28 changes: 0 additions & 28 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,34 +222,6 @@ function gutenberg_register_vendor_scripts( $scripts ) {
array( 'react' )
);

/*
* This script registration and the corresponding function should be removed
* once the plugin is updated to support WordPress 5.4.0 and newer.
*
* See: `gutenberg_add_url_polyfill`
*/
gutenberg_register_vendor_script(
$scripts,
'wp-polyfill-url',
'https://unpkg.com/core-js-url-browser@3.6.4/url' . $suffix . '.js',
array(),
'3.6.4'
);

/*
* This script registration and the corresponding function should be removed
* removed once the plugin is updated to support WordPress 5.4.0 and newer.
*
* See: `gutenberg_add_dom_rect_polyfill`
*/
gutenberg_register_vendor_script(
$scripts,
'wp-polyfill-dom-rect',
'https://unpkg.com/polyfill-library@3.42.0/polyfills/DOMRect/polyfill.js',
array(),
'3.42.0'
);

/*
* This script registration and the corresponding function should be removed
* removed once the plugin is updated to support WordPress 5.6.0 and newer.
Expand Down
100 changes: 0 additions & 100 deletions lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,106 +233,6 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
}
}

/**
* Extends block editor settings to include a list of image dimensions per size.
*
* This can be removed when plugin support requires WordPress 5.4.0+.
*
* @see https://core.trac.wordpress.org/ticket/49389
* @see https://core.trac.wordpress.org/changeset/47240
*
* @param array $settings Default editor settings.
*
* @return array Filtered editor settings.
*/
function gutenberg_extend_settings_image_dimensions( $settings ) {
/*
* Only filter settings if:
* 1. `imageDimensions` is not already assigned, in which case it can be
* assumed to have been set from WordPress 5.4.0+ default settings.
* 2. `imageSizes` is an array. Plugins may run `block_editor_settings`
* directly and not provide all properties of the settings array.
*/
if ( ! isset( $settings['imageDimensions'] ) && ! empty( $settings['imageSizes'] ) ) {
$image_dimensions = array();
$all_sizes = wp_get_registered_image_subsizes();
foreach ( $settings['imageSizes'] as $size ) {
$key = $size['slug'];
if ( isset( $all_sizes[ $key ] ) ) {
$image_dimensions[ $key ] = $all_sizes[ $key ];
}
}
$settings['imageDimensions'] = $image_dimensions;
}

return $settings;
}
add_filter( 'block_editor_settings', 'gutenberg_extend_settings_image_dimensions' );

/**
* Adds a polyfill for the WHATWG URL in environments which do not support it.
* The intention in how this action is handled is under the assumption that this
* code would eventually be placed at `wp_default_packages_vendor`, which is
* called as a result of `wp_default_packages` via the `wp_default_scripts`.
*
* This can be removed when plugin support requires WordPress 5.4.0+.
*
* The script registration occurs in `gutenberg_register_vendor_scripts`, which
* should be removed in coordination with this function.
*
* @see gutenberg_register_vendor_scripts
* @see https://core.trac.wordpress.org/ticket/49360
* @see https://developer.mozilla.org/en-US/docs/Web/API/URL/URL
* @see https://developer.wordpress.org/reference/functions/wp_default_packages_vendor/
*
* @since 7.3.0
*
* @param WP_Scripts $scripts WP_Scripts object.
*/
function gutenberg_add_url_polyfill( $scripts ) {
did_action( 'init' ) && $scripts->add_inline_script(
'wp-polyfill',
wp_get_script_polyfill(
$scripts,
array(
'window.URL && window.URL.prototype && window.URLSearchParams' => 'wp-polyfill-url',
)
)
);
}
add_action( 'wp_default_scripts', 'gutenberg_add_url_polyfill', 20 );

/**
* Adds a polyfill for DOMRect in environments which do not support it.
*
* This can be removed when plugin support requires WordPress 5.4.0+.
*
* The script registration occurs in `gutenberg_register_vendor_scripts`, which
* should be removed in coordination with this function.
*
* @see gutenberg_register_vendor_scripts
* @see gutenberg_add_url_polyfill
* @see https://core.trac.wordpress.org/ticket/49360
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
* @see https://developer.wordpress.org/reference/functions/wp_default_packages_vendor/
*
* @since 7.5.0
*
* @param WP_Scripts $scripts WP_Scripts object.
*/
function gutenberg_add_dom_rect_polyfill( $scripts ) {
did_action( 'init' ) && $scripts->add_inline_script(
'wp-polyfill',
wp_get_script_polyfill(
$scripts,
array(
'window.DOMRect' => 'wp-polyfill-dom-rect',
)
)
);
}
add_action( 'wp_default_scripts', 'gutenberg_add_dom_rect_polyfill', 20 );

/**
* Adds a wp.date.setSettings with timezone abbr parameter
*
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Gutenberg ===
Contributors: matveb, joen, karmatosed
Requires at least: 5.3.0
Tested up to: 5.4
Requires at least: 5.4.0
Tested up to: 5.5
Requires PHP: 5.6
Stable tag: V.V.V
License: GPLv2 or later
Expand Down

0 comments on commit 0679889

Please sign in to comment.