Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Disable TinyMCE compat with classic editor #52325

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Jul 5, 2023

What?

This PR makes the TinyMCE removal experiment compatible with the Classic Editor plugin and other plugins that disable the block editor.

Why?

In #50387 we introduced an experiment that allows us to remove TinyMCE from initial loading when we can. We're now polishing it in terms of plugin interoperability to make sure there are regressions and weird edge cases.

How?

We augment the existing gutenberg_post_being_edited_requires_classic_block() checks to also handle if the use_block_editor_for_post_type filter was used to disable the block editor specifically for a post type. This is the same filter that the Classic Editor plugin is using.

Testing Instructions

  • Activate the "Disable TinyMCE" experiment if it's not active yet.
  • Install and activate the "Classic Editor" plugin.
  • Start writing a new post.
  • Verify the TinyMCE editor loads and works correctly and there are no errors in the console.
  • Disable the "Classic Editor" plugin.
  • Start writing a new post.
  • Verify you can see the block editor and there is still no "Classic" block available.

Testing Instructions for Keyboard

None

Screenshots or screencast

None

@tyxla tyxla added [Type] Enhancement A suggestion for improvement. [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. [Type] Performance Related to performance efforts [Block] Classic Affects the Classic Editor Block [Type] Experimental Experimental feature or API. labels Jul 5, 2023
@tyxla tyxla self-assigned this Jul 5, 2023
@tyxla tyxla requested a review from spacedmonkey as a code owner July 5, 2023 11:14
Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's no harm in this. I'm a bit surprised that check is a function and not a filter, but that's not relevant to this change.

Thanks @tyxla for following up on this.

@tyxla tyxla merged commit 7d3ec58 into trunk Jul 10, 2023
@tyxla tyxla deleted the fix/disable-tinymce-classic-editor branch July 10, 2023 15:00
@github-actions github-actions bot added this to the Gutenberg 16.3 milestone Jul 10, 2023
@tyxla
Copy link
Member Author

tyxla commented Jul 10, 2023

I'm a bit surprised that check is a function and not a filter, but that's not relevant to this change.

Well, there's a filter with the same name so plugins can alter it, but there are a few more conditions under which the filter never runs. It's a bit odd because in those cases, the filter will not be considered. So the safer bet is to use the function:

https://github.com/WordPress/wordpress-develop/blob/f933aa3616aa8d49bdd67886e4af287579093c25/src/wp-includes/post.php#L8016-L8039

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Warning: Type of PR label error

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Accessibility (a11y), [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: [Type] Enhancement, [Type] Plugin Interoperability, [Type] Performance, [Block] Classic, [Type] Experimental.

Read more about Type labels in Gutenberg.

@mikachan mikachan removed the Needs PHP backport Needs PHP backport to Core label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [Type] Enhancement A suggestion for improvement. [Type] Experimental Experimental feature or API. [Type] Performance Related to performance efforts [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants