Skip to content

Commit

Permalink
Remove custom font face resolver.
Browse files Browse the repository at this point in the history
This seems to mostly work in WordPress 6.7 now: WordPress/wordpress-develop#7581
  • Loading branch information
justintadlock committed Oct 21, 2024
1 parent 6625512 commit 6a343e9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 226 deletions.
38 changes: 0 additions & 38 deletions src/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*
Expand Down Expand Up @@ -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 `<style>` tag.
//
// phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags
wp_add_inline_style('x3p0-ideas-fonts', trim(strip_tags($content)));

wp_enqueue_style('x3p0-ideas-fonts');
}

/**
* Customizes the block editor settings.
*
Expand Down
188 changes: 0 additions & 188 deletions src/Tools/FontFaceResolver.php

This file was deleted.

0 comments on commit 6a343e9

Please sign in to comment.