Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: removed

Block editor: Remove hotfix for Gutenberg v19.0, v20.0 and v20.1

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,3 @@ function ( $content ) {
1
);
}

/**
* Overrides the `wp-block-editor` script with a hotfix to prevent a performance issue present in
* Gutenberg v19.0, v20.0, and v20.1 (see https://github.com/WordPress/gutenberg/issues/68875).
*
* Our custom script has been generated by applying the fix introduced in Gutenberg v20.2
* (see https://github.com/WordPress/gutenberg/pull/68898) in a local Gutenberg environment and
* running `npm run build` to extract the fixed `wp-block-editor` script.
*
* @param WP_Scripts $scripts WP_Scripts instance.
*/
function wpcom_fix_performance_issue_block_editor_v19_9_v20_0_v20_1( $scripts ) {
if ( ! defined( 'GUTENBERG_VERSION' ) ) {
return;
}

if ( ! in_array( GUTENBERG_VERSION, array( '19.9.0', '20.0.0', '20.1.0' ), true ) ) {
return;
}

$path = gutenberg_dir_path() . 'build/block-editor/index.min.js';
$handle = 'wp-block-editor';
$asset_file = substr( $path, 0, - ( strlen( '.js' ) ) ) . '.asset.php';
$asset = file_exists( $asset_file ) ? require $asset_file : null;
$dependencies = $asset['dependencies'] ?? array();
$version = $asset['version'] ?? GUTENBERG_VERSION;
gutenberg_override_script(
$scripts,
$handle,
plugins_url( 'wp-block-editor-' . GUTENBERG_VERSION . '-hotfix.min.js', __FILE__ ),
$dependencies,
$version,
true
);
}
add_action( 'wp_default_scripts', 'wpcom_fix_performance_issue_block_editor_v19_9_v20_0_v20_1', 11 );