diff --git a/.github/ISSUE_TEMPLATE/Bug_report_mobile.md b/.github/ISSUE_TEMPLATE/Bug_report_mobile.md index 06b6fad1bb6bc3..8347a6649ea8d6 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report_mobile.md +++ b/.github/ISSUE_TEMPLATE/Bug_report_mobile.md @@ -44,7 +44,7 @@ the bug. --> ## WordPress information -- WordPress version: +- WordPress version: - Gutenberg version: - Are all plugins except Gutenberg deactivated? - Are you using a default theme (e.g. Twenty Twenty-One)? diff --git a/gutenberg.php b/gutenberg.php index 8b975db8bcd245..99db6cf387482e 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -3,7 +3,7 @@ * Plugin Name: Gutenberg * Plugin URI: https://github.com/WordPress/gutenberg * Description: Printing since 1440. This is the development plugin for the new block editor in core. - * Requires at least: 5.6 + * Requires at least: 5.7 * Requires PHP: 5.6 * Version: 11.4.0 * Author: Gutenberg Team @@ -26,7 +26,7 @@ function gutenberg_wordpress_version_notice() { echo '

'; /* translators: %s: Minimum required version */ - printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.6' ); + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.7' ); echo '

'; deactivate_plugins( array( 'gutenberg/gutenberg.php' ) ); @@ -64,7 +64,7 @@ function gutenberg_pre_init() { // Compare against major release versions (X.Y) rather than minor (X.Y.Z) // unless a minor release is the actual minimum requirement. WordPress reports // X.Y for its major releases. - if ( version_compare( $version, '5.6', '<' ) ) { + if ( version_compare( $version, '5.7', '<' ) ) { add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); return; } diff --git a/lib/block-supports/align.php b/lib/block-supports/align.php deleted file mode 100644 index a33a7700a5d0b5..00000000000000 --- a/lib/block-supports/align.php +++ /dev/null @@ -1,59 +0,0 @@ -attributes ) { - $block_type->attributes = array(); - } - - if ( ! array_key_exists( 'align', $block_type->attributes ) ) { - $block_type->attributes['align'] = array( - 'type' => 'string', - 'enum' => array( 'left', 'center', 'right', 'wide', 'full', '' ), - ); - } - } -} - -/** - * Add CSS classes for block alignment to the incoming attributes array. - * This will be applied to the block markup in the front-end. - * - * @param WP_Block_Type $block_type Block Type. - * @param array $block_attributes Block attributes. - * - * @return array Block alignment CSS classes and inline styles. - */ -function gutenberg_apply_alignment_support( $block_type, $block_attributes ) { - $attributes = array(); - $has_align_support = gutenberg_block_has_support( $block_type, array( 'align' ), false ); - if ( $has_align_support ) { - $has_block_alignment = array_key_exists( 'align', $block_attributes ); - - if ( $has_block_alignment ) { - $attributes['class'] = sprintf( 'align%s', $block_attributes['align'] ); - } - } - - return $attributes; -} - -// Register the block support. -WP_Block_Supports::get_instance()->register( - 'align', - array( - 'register_attribute' => 'gutenberg_register_alignment_support', - 'apply' => 'gutenberg_apply_alignment_support', - ) -); diff --git a/lib/block-supports/custom-classname.php b/lib/block-supports/custom-classname.php deleted file mode 100644 index 612eaf30bd50ce..00000000000000 --- a/lib/block-supports/custom-classname.php +++ /dev/null @@ -1,58 +0,0 @@ -attributes ) { - $block_type->attributes = array(); - } - - if ( ! array_key_exists( 'className', $block_type->attributes ) ) { - $block_type->attributes['className'] = array( - 'type' => 'string', - ); - } - } -} - -/** - * Add the custom classnames to the output. - * - * @param WP_Block_Type $block_type Block Type. - * @param array $block_attributes Block attributes. - * - * @return array Block CSS classes and inline styles. - */ -function gutenberg_apply_custom_classname_support( $block_type, $block_attributes ) { - $has_custom_classname_support = gutenberg_block_has_support( $block_type, array( 'customClassName' ), true ); - $attributes = array(); - if ( $has_custom_classname_support ) { - $has_custom_classnames = array_key_exists( 'className', $block_attributes ); - - if ( $has_custom_classnames ) { - $attributes['class'] = $block_attributes['className']; - } - } - - return $attributes; -} - -// Register the block support. -WP_Block_Supports::get_instance()->register( - 'custom-classname', - array( - 'register_attribute' => 'gutenberg_register_custom_classname_support', - 'apply' => 'gutenberg_apply_custom_classname_support', - ) -); diff --git a/lib/block-supports/generated-classname.php b/lib/block-supports/generated-classname.php deleted file mode 100644 index 8be75f6431fb2e..00000000000000 --- a/lib/block-supports/generated-classname.php +++ /dev/null @@ -1,61 +0,0 @@ -name ); - - if ( $block_classname ) { - $attributes['class'] = $block_classname; - } - } - - return $attributes; -} - -// Register the block support. -WP_Block_Supports::get_instance()->register( - 'generated-classname', - array( - 'apply' => 'gutenberg_apply_generated_classname_support', - ) -); diff --git a/lib/client-assets.php b/lib/client-assets.php index 603576ed45f5f4..2f8d3ed48fa810 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -96,13 +96,6 @@ function gutenberg_override_script( $scripts, $handle, $src, $deps = array(), $v $scripts->set_translations( $handle, 'default' ); } - // Remove this check once the minimum supported WordPress version is at least 5.7. - if ( 'wp-i18n' === $handle ) { - $ltr = 'rtl' === _x( 'ltr', 'text direction', 'default' ) ? 'rtl' : 'ltr'; - $output = sprintf( "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ '%s' ] }, 'default' );", $ltr ); - $scripts->add_inline_script( 'wp-i18n', $output, 'after' ); - } - /* * Wp-editor module is exposed as window.wp.editor. * Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor. @@ -223,18 +216,6 @@ function gutenberg_register_vendor_scripts( $scripts ) { 'https://unpkg.com/react-dom@17.0.1/umd/react-dom' . $react_suffix . '.js', array( 'react' ) ); - - /* - * This script registration and the corresponding function should be removed - * removed once the plugin is updated to support WordPress 5.7.0 and newer. - */ - gutenberg_register_vendor_script( - $scripts, - 'object-fit-polyfill', - 'https://unpkg.com/objectFitPolyfill@2.3.5/dist/objectFitPolyfill.min.js', - array(), - '2.3.5' - ); } add_action( 'wp_default_scripts', 'gutenberg_register_vendor_scripts' ); @@ -797,31 +778,3 @@ function gutenberg_extend_block_editor_styles_html() { add_action( 'admin_footer-post.php', 'gutenberg_extend_block_editor_styles_html' ); add_action( 'admin_footer-post-new.php', 'gutenberg_extend_block_editor_styles_html' ); add_action( 'admin_footer-widgets.php', 'gutenberg_extend_block_editor_styles_html' ); - -/** - * Adds a polyfill for object-fit in environments which do not support it. - * - * The script registration occurs in `gutenberg_register_vendor_scripts`, which - * should be removed in coordination with this function. - * - * Remove this when the minimum supported version is WordPress 5.7 - * - * @see gutenberg_register_vendor_scripts - * @see https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit - * - * @since 9.1.0 - * - * @param WP_Scripts $scripts WP_Scripts object. - */ -function gutenberg_add_object_fit_polyfill( $scripts ) { - did_action( 'init' ) && $scripts->add_inline_script( - 'wp-polyfill', - wp_get_script_polyfill( - $scripts, - array( - '"objectFit" in document.documentElement.style' => 'object-fit-polyfill', - ) - ) - ); -} -add_action( 'wp_default_scripts', 'gutenberg_add_object_fit_polyfill', 20 ); diff --git a/lib/load.php b/lib/load.php index 57692dc37319ca..c825a685cbd1f0 100644 --- a/lib/load.php +++ b/lib/load.php @@ -121,12 +121,9 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/global-styles.php'; require __DIR__ . '/pwa.php'; -require __DIR__ . '/block-supports/generated-classname.php'; require __DIR__ . '/block-supports/elements.php'; require __DIR__ . '/block-supports/colors.php'; -require __DIR__ . '/block-supports/align.php'; require __DIR__ . '/block-supports/typography.php'; -require __DIR__ . '/block-supports/custom-classname.php'; require __DIR__ . '/block-supports/border.php'; require __DIR__ . '/block-supports/layout.php'; require __DIR__ . '/block-supports/spacing.php';