Skip to content

Commit

Permalink
Do not enqueue any TinyMCE assets if experiment is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed May 5, 2023
1 parent 723eb31 commit e040dc2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/experimental/disable-tinymce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
add_action( 'admin_init', 'gutenberg_disable_tinymce' );
function gutenberg_disable_tinymce() {
$gutenberg_experiments = get_option( 'gutenberg-experiments' );
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-no-tinymce', $gutenberg_experiments ) ) {
require __DIR__ . '/wp-editors-class-placeholder.php';
}
}
4 changes: 4 additions & 0 deletions lib/experimental/wp-editors-class-placeholder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
final class _WP_Editors {
public static function enqueue_default_editor() {}
}
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/experimental/kses.php';
require __DIR__ . '/experimental/l10n.php';
require __DIR__ . '/experimental/navigation-fallback.php';
require __DIR__ . '/experimental/disable-tinymce.php';

// Fonts API.
if ( ! class_exists( 'WP_Fonts' ) ) {
Expand Down

0 comments on commit e040dc2

Please sign in to comment.