From 6a343e9c4193418065c8568fa7174ea36737826f Mon Sep 17 00:00:00 2001 From: Justin Tadlock Date: Mon, 21 Oct 2024 15:02:08 -0500 Subject: [PATCH] Remove custom font face resolver. This seems to mostly work in WordPress 6.7 now: https://github.com/WordPress/wordpress-develop/pull/7581 --- src/Editor.php | 38 ------- src/Tools/FontFaceResolver.php | 188 --------------------------------- 2 files changed, 226 deletions(-) delete mode 100644 src/Tools/FontFaceResolver.php diff --git a/src/Editor.php b/src/Editor.php index 088258f4..b0f8c937 100644 --- a/src/Editor.php +++ b/src/Editor.php @@ -16,7 +16,6 @@ namespace X3P0\Ideas; use X3P0\Ideas\Contracts\Bootable; -use X3P0\Ideas\Tools\FontFaceResolver; use X3P0\Ideas\Tools\Hooks\{Action, Filter, Hookable}; class Editor implements Bootable @@ -34,17 +33,6 @@ public function boot(): void $this->hookMethods(); } - /** - * Runs actions only when viewing the Site Editor screen. - * - * @since 1.0.0 - */ - #[Action('load-site-editor.php')] - public function loadSiteEditor(): void - { - add_action('enqueue_block_assets', [$this, 'enqueueFonts']); - } - /** * Add editor stylesheets. * @@ -90,32 +78,6 @@ public function enqueueAssets(): void wp_set_script_translations('x3p0-ideas-editor', 'x3p0-ideas'); } - /** - * Enqueues local web fonts. This is necessary to fix the broken Site - * Editor preview with style variations in WordPress. - * - * @since 1.0.0 - * @link https://github.com/WordPress/gutenberg/issues/59965 - */ - public function enqueueFonts(): void - { - ob_start(); - wp_print_font_faces(FontFaceResolver::getFonts()); - $content = ob_get_clean(); - - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion - wp_register_style('x3p0-ideas-fonts', false); - - // In this case, we specifically want to use `strip_tags()`. - // `wp_strip_all_tags()` will remove all the inner content from - // the `