From d6b7c24e0124c299498637f28692f497a9f429bb Mon Sep 17 00:00:00 2001 From: Marcelo Serpa <81248+fullofcaffeine@users.noreply.github.com> Date: Tue, 13 Sep 2022 11:09:01 -0500 Subject: [PATCH 1/3] Set the callback priority to 22 to prevent it from causing style issues with sites that have Gutenberg > 13.5 activated --- projects/plugins/jetpack/modules/google-fonts.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/modules/google-fonts.php b/projects/plugins/jetpack/modules/google-fonts.php index 7d9f91fec524b..179450b230ede 100644 --- a/projects/plugins/jetpack/modules/google-fonts.php +++ b/projects/plugins/jetpack/modules/google-fonts.php @@ -104,4 +104,7 @@ function jetpack_add_google_fonts_provider() { add_filter( 'wp_resource_hints', '\Automattic\Jetpack\Fonts\Utils::font_source_resource_hint', 10, 2 ); add_filter( 'pre_render_block', '\Automattic\Jetpack\Fonts\Introspectors\Blocks::enqueue_block_fonts', 10, 2 ); -add_action( 'init', '\Automattic\Jetpack\Fonts\Introspectors\Global_Styles::enqueue_global_styles_fonts' ); +// The priority for the next hook is is set to 22 because the default (or lower) +// because it was causing style issues if it ran before the `gutenberg_register_webfonts_from_theme_json` +// which runs in the same hook but at priority 21. +add_action( 'init', '\Automattic\Jetpack\Fonts\Introspectors\Global_Styles::enqueue_global_styles_fonts', 22 ); From 87413a3450640da3ade5eeab340e96ee45b598ce Mon Sep 17 00:00:00 2001 From: Marcelo Serpa <81248+fullofcaffeine@users.noreply.github.com> Date: Tue, 13 Sep 2022 11:20:02 -0500 Subject: [PATCH 2/3] Changelog --- .../changelog/fix-site-title-block-block-style-missing | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/fix-site-title-block-block-style-missing diff --git a/projects/plugins/jetpack/changelog/fix-site-title-block-block-style-missing b/projects/plugins/jetpack/changelog/fix-site-title-block-block-style-missing new file mode 100644 index 0000000000000..319191bdbe558 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-site-title-block-block-style-missing @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Set the `Automattic\Jetpack\Fonts\Introspectors\Global_Styles::enqueue_global_styles_fonts` callback priority in the `init` hook to 22 to prevent it from causing style issues with sites that have Gutenberg > 13.5 activated. From 9def01d030377276c4bab03e25b1732e4dd59e18 Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Mon, 19 Sep 2022 15:34:49 -0500 Subject: [PATCH 3/3] Update projects/plugins/jetpack/modules/google-fonts.php Co-authored-by: Brad Jorsch --- projects/plugins/jetpack/modules/google-fonts.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/jetpack/modules/google-fonts.php b/projects/plugins/jetpack/modules/google-fonts.php index 179450b230ede..501cc9bdbfb54 100644 --- a/projects/plugins/jetpack/modules/google-fonts.php +++ b/projects/plugins/jetpack/modules/google-fonts.php @@ -104,7 +104,7 @@ function jetpack_add_google_fonts_provider() { add_filter( 'wp_resource_hints', '\Automattic\Jetpack\Fonts\Utils::font_source_resource_hint', 10, 2 ); add_filter( 'pre_render_block', '\Automattic\Jetpack\Fonts\Introspectors\Blocks::enqueue_block_fonts', 10, 2 ); -// The priority for the next hook is is set to 22 because the default (or lower) -// because it was causing style issues if it ran before the `gutenberg_register_webfonts_from_theme_json` -// which runs in the same hook but at priority 21. +// The priority for the next hook is is set to 22 because it needs to run after Gutenberg's +// re-registration (at priority 22) of the core blocks it de-registers (at the default priority 10), +// otherwise Gutenberg caches an incorrect state. add_action( 'init', '\Automattic\Jetpack\Fonts\Introspectors\Global_Styles::enqueue_global_styles_fonts', 22 );