Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @wordpress packages #2048

Closed
wants to merge 15 commits into from

Conversation

noisysocks
Copy link
Member

@noisysocks noisysocks commented Dec 13, 2021

Update packages to include these bug fixes from Gutenberg:

Trac ticket: https://core.trac.wordpress.org/ticket/54487


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@noisysocks
Copy link
Member Author

@oandregal:

Could you please add in the PHP changes from these two PRs of yours to this branch? I am not too sure how to do it as things are a little different in Core.

Could you also please double check that I backported the PHP changes in these two PRs of yours properly?

@youknowriad:

Could you please check to see if I missed any backports from your recent PRs? It was a little difficult to spot changes amongst the refactoring that you were doing.

@noisysocks
Copy link
Member Author

noisysocks commented Dec 13, 2021

WordPress/gutenberg#37315 should fix the test failures, but will need to merge that PR and do another npm publish. I can do that tomorrow.

@ocean90
Copy link
Member

ocean90 commented Dec 13, 2021

@noisysocks Are you okay when I merge the changes from #2009 into this PR?
This was missed in an previous update and is related to WordPress/gutenberg#37132.

@youknowriad
Copy link
Contributor

youknowriad commented Dec 13, 2021

@noisysocks I believe I've done all the necessary backports from these "sync" PRs, I left the labels there to sync with wp/trunk branch 👍

@oandregal
Copy link
Member

oandregal commented Dec 13, 2021

@noisysocks I've double-checked the PRs you mentioned and are backported fine!

As for the other two, pasting the patch below (to be applied by git apply <patch>) would do it. I've tried to push directly to this PR but I didn't have the right to do it. I presume it's because I'm not part of some WordPress GitHub group in this repo.

diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php
index 7205ef2f4a..f175eff85d 100644
--- a/src/wp-includes/block-editor.php
+++ b/src/wp-includes/block-editor.php
@@ -311,7 +311,6 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
                array(
                        'css'                     => 'variables',
                        '__unstableType'          => 'presets',
-                       '__experimentalNoWrapper' => true,
                ),
                array(
                        'css'            => 'presets',
diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
index 39c7119fbc..fda548ed54 100644
--- a/src/wp-includes/default-filters.php
+++ b/src/wp-includes/default-filters.php
@@ -563,6 +563,7 @@ add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_
 add_action( 'enqueue_block_editor_assets', 'enqueue_editor_block_styles_assets' );
 add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
 add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_format_library_assets' );
+add_action( 'enqueue_block_editor_assets', 'wp_enqueue_global_styles_css_custom_properties' );
 add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' );
 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 8313088e67..8384b6b2d8 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -2863,3 +2863,12 @@ function wp_add_iframed_editor_assets_html() {
 
        echo "<script>window.__editorAssets = $editor_assets</script>";
 }
+
+/**
+ * Function that enqueues the CSS Custom Properties coming from theme.json.
+ */
+function wp_enqueue_global_styles_css_custom_properties() {
+       wp_register_style( 'global-styles-css-custom-properties', false, array(), true, true );
+       wp_add_inline_style( 'global-styles-css-custom-properties', wp_get_global_stylesheet( array( 'variables' ) ) );
+       wp_enqueue_style( 'global-styles-css-custom-properties' );
+}

The way I've tested it is by loading the site editor with TwentyTwentyTwo active. Then, go to the global styles sidebar, navigate to the palette editor, chose the gradients tab, and verify that they look like this (before this PR they would have been greyed out):

Captura de ecrã de 2021-12-13 17-52-26

I've also tested that visiting /wp-admin/load-styles.php?load=wp-components still worked fine (styles are output) as we've had some issues in the past, see #1325 for reference.

@noisysocks
Copy link
Member Author

@noisysocks Are you okay when I merge the changes from #2009 into this PR?
This was missed in an previous update and is related to WordPress/gutenberg#37132.

Not a problem. I've merged your branch into my one.

@noisysocks I believe I've done all the necessary backports from these "sync" PRs, I left the labels there to sync with wp/trunk branch 👍

Thanks!

@noisysocks I've double-checked the PRs you mentioned and are backported fine!

As for the other two, pasting the patch below (to be applied by git apply <patch>) would do it. I've tried to push directly to this PR but I didn't have the right to do it. I presume it's because I'm not part of some WordPress GitHub group in this repo.

Thank you! I've applied the patch.


I'm just going to do another round of npm publishing so that we have WordPress/gutenberg#37341 and WordPress/gutenberg#37315. I see that @hellofromtonya fixed the failing test in 1272182 by updating the assertion but IMO the test failure was legitimate. WordPress/gutenberg#37315 is the proper fix.

I'll commit when ready and when tests pass 🙂

@noisysocks
Copy link
Member Author

Committed! Thanks everyone. https://core.trac.wordpress.org/changeset/52364

@noisysocks noisysocks closed this Dec 14, 2021
@noisysocks noisysocks deleted the update/packages branch December 14, 2021 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants