Disable TinyMCE: Repurpose experiment as Classic block removal#77838
Conversation
| @@ -1,39 +0,0 @@ | |||
| /* eslint-disable no-undef */ | |||
| async function reloadWithTinymce() { | |||
There was a problem hiding this comment.
None of the proxy magic is now necessary when we keep TinyMCE loaded as usual.
|
|
||
| // phpcs:disable PEAR.NamingConventions.ValidClassName.StartWithCapital | ||
|
|
||
| if ( ! class_exists( '_WP_Editors' ) ) { |
There was a problem hiding this comment.
This isn't necessary anymore, we're running with the core class which enqueues all the TinyMCE stuff. To change this to a more opt-in behavior, we should make changes in core to make the TinyMCE asset loading and init more flexible.
| * @package gutenberg | ||
| */ | ||
|
|
||
| // add_action( 'admin_footer', 'gutenberg_test_tinymce_access' ); // Uncomment the following line to force an external TinyMCE usage. |
| add_action( 'admin_print_footer_scripts', 'gutenberg_declare_classic_block_necessary', 20 ); | ||
|
|
||
| // If user has already requested TinyMCE, we're ending the experiment. | ||
| if ( ! empty( $_GET['requiresTinymce'] ) || gutenberg_post_being_edited_requires_classic_block() ) { |
There was a problem hiding this comment.
That check is no longer needed, we're not aggressively replacing core classes anymore.
| wp_dequeue_script( 'mce-view' ); | ||
| } | ||
|
|
||
| add_action( 'wp_enqueue_media', 'gutenberg_wp_enqueue_media' ); |
There was a problem hiding this comment.
Removing this as well as it might break unexpected media functionality
| wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGridInteractivity = true', 'before' ); | ||
| } | ||
| if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) { | ||
| wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' ); |
There was a problem hiding this comment.
This flag won't be necessary now
| $script = $scripts->query( $handle, 'registered' ); | ||
| if ( | ||
| ! gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) || | ||
| ! empty( $_GET['requiresTinymce'] ) || |
There was a problem hiding this comment.
This isn't necessary now that we're not doing any redirect magic
| ) ) | ||
| ) { | ||
| // Register the classic block if the current post contains a classic block | ||
| if ( window?.wp?.oldEditor && window?.wp?.needsClassicBlock ) { |
There was a problem hiding this comment.
This is greatly simplified now that we don't need the experimental flag or the redirect flag.
It will be refactored when @yuliyan works on always registering the block but hiding it in the inserter instead.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: -37 B (0%) Total Size: 7.87 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Actually, it seems like the missing block functionality will break a bunch of integration tests. Since we're reworking it, I'll change the logic to always register the classic block when the experiment is off. |
|
Going to merge - the failing e2e test is failing in other branches too. |
|
Oddly and unfortunately, the Classic block still gets a lot of usage. Here's example from past release - #73792. I thought I removed feature, that wasn't really functional with the block, but reports showed different case. P.S. I'm in favor of removal, just wanted to share prev experience. |
|
@Mamaduka, thanks for chiming in. No doubt about the usage, I'm monitoring a few places where I have access to block usage, and it is quite substantial indeed for the Classic block. That's exactly why we're taking a step back with the experiment, but also because just preventing TinyMCE from loading breaks tons of existing plugins and use cases, and it has to be approached differently. The plan is to consider decreasing Classic block usage in natural ways - removing it from the inserter for new sites by default (@yuliyan is working on adding a filter to allow controlling that), but still keeping it active for when it's actually used. Then we can also work on migration paths and making the migration more compelling. As for TinyMCE, we should approach it from Core and slowly walk the path towards making it fully opt-in in core, which includes working with the top plugins that rely on it. This will be completely distinct from the present experiment. |
* Disable TinyMCE: Repurpose experiment as Classic block removal * Still consider the experimental flag for now Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: yuliyan <yuliyan@git.wordpress.org>
|
I just cherry-picked this PR to the release/23.1 branch to get it included in the next release: 679a6ac |


What?
Reframes the
gutenberg-no-tinymceexperiment from "disable TinyMCE entirely" to "hide the Classic block from inserters." The Classic block is still registered (and TinyMCE still loads) on posts that already contain a Classic block, so existing content keeps working.Why?
Disabling TinyMCE outright was too aggressive - it broke any flow outside the Classic block that still relies on TinyMCE (and required the proxy/reload escape hatch to recover, which was terrible user experience most of the cases). Scoping the experiment to just hiding the Classic block in inserters delivers the practical goal (steering new content away from Classic) without the proxy/reload machinery and the global TinyMCE replacement.
How?
Removed:
_WP_Editorsplaceholder classrequiresTinymcequery-arg reload flowmce-viewdequeue and thegutenberg_test_tinymce_accessdebug helper__experimentalDisableTinymcewindow flag wiringUpdated:
the block editor."
window.wp.needsClassicBlockis true. This logic be changed in another PR that @yuliyan is working onTesting Instructions
(TinyMCE loads as usual).
Testing Instructions for Keyboard
Screenshots or screencast
None
Use of AI Tools
Opus 4.7