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

Restore gutenberg_add_edit_link_for_post_type filter. #3159

Closed
wants to merge 1 commit into from

Conversation

iandunn
Copy link
Member

@iandunn iandunn commented Oct 25, 2017

Description

The filter was added in 6884717, but then removed in bdf94e6. It's being added back because Gutenberg does not yet have support for advanced meta boxes, which many custom post types rely on.

Gutenberg should not be the default editor for post types which it does not fully support, because that leads to a poor user experience.

gutenberg_add_edit_link_for_post_type isn't a good name for this filter, since it's true purpose is to prevent Gutenberg from doing anything with CPTs that opt-out of it. For the initial draft, though, I left it as-is in order to get feedback. One advantage of keeping it is that it preserves back-compat with sites that are already using it.

It may also not be worth changing at this time, since I imagine a different solution will be desired by the time the plugin gets closer to the merge with Core. @BE-Webdesign suggested using post_type_supports( 'block_editor' ) instead of a filter, which seems like a good idea to me, and would be a much more semantic solution. That would not necessarily mean that support would be off by default; Gutenberg could enable it by default, similar to how the REST API did.

I'm happy to adjust the PR if y'all prefer that approach instead.

This also likely conflicts with #3146, but I'm happy to adapt this one if it's accepted after that one is merged.

Fixes #3158

Testing

  1. Setup a callback for the filter, similar to 5944-meta
  2. Visit wp-admin/edit.php; the Classic Editor link appears when hovering over an post in the list
  3. Open one of those posts using the default link; it should open in Gutenberg.
  4. Visit the posts lists for a CPT that is disabled by the filter above, e.g., wp-admin/edit.php?post_type=wordcamp; the Classic Editor links should not appear when hovering over a post.
  5. Open one of those posts using the default link; it should open in the classic editor instead of Gutenberg.

This was added in 6884717, but then removed in bdf94e6. It's being added back because Gutenberg does not yet have support for advanced meta boxes, which many custom post types rely on.

Gutenberg should not be the default editor for post types which it does not fully support, because that leads to a poor user experience.
@codecov
Copy link

codecov bot commented Oct 25, 2017

Codecov Report

Merging #3159 into master will decrease coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3159      +/-   ##
==========================================
- Coverage   31.66%   31.55%   -0.12%     
==========================================
  Files         217      217              
  Lines        6263     6285      +22     
  Branches     1112     1121       +9     
==========================================
  Hits         1983     1983              
- Misses       3600     3613      +13     
- Partials      680      689       +9
Impacted Files Coverage Δ
editor/writing-flow/index.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab91160...c25de87. Read the comment docs.

@iandunn
Copy link
Member Author

iandunn commented Oct 26, 2017

Another idea would be to detect if the post type has any advanced meta boxes registered, and then default to the classic editor. That would avoid plugins from having to manually setup the exclusion, and it could be removed when Gutenberg adds support for those meta boxes.

I still think it'd be kind to have a filter that allows plugins to easily opt-out, though, since we'll never be able to detect every situation where Gutenberg doesn't work well.

@pento
Copy link
Member

pento commented Oct 26, 2017

Rather than worrying about having to rebase and such after #3146, I added a filter in 2c41835, to disable Gutenberg by post type. Does that fix the issue for you?

@iandunn
Copy link
Member Author

iandunn commented Oct 26, 2017

It does, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor UX after removing gutenberg_add_edit_link_for_post_type filter
2 participants