-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Post context is not available to the block_editor_settings_all
filter in the Site Editor
#63525
Comments
When bootstrapped, the site editor has no concept like the current post. Unlike the post editor, it can load or handle multiple entities at the same time. |
Yeah, that's what I assumed. However, as more and more editing starts to take place in the Site Editor, we will need some sort of curation mechanism that mimics |
@youknowriad @ntsekouras looping you both in since the new Posts dashboard is now available via a Gutenberg experiment and the following filter does not work there.
The Code Editor will be disabled in the normal Post Editor, but it's not disabled in the new Posts dashboard editor. |
I think the I think For instance in the latest example if we want |
The It would be great if we could define Editor settings via post type endpoint / registration. That makes a lot of sense. Your curating functionality at the post type. |
I agree but what I'm saying is that it doesn't scale to where we want to take WP-Admin and the site editor. kind of like an SPA so we need to figure a more semantic/declarative approach and adding these properties to the post type registration seems like the way to go for me. |
Completely agree. It would be amazing if something like this could be implemented for 6.7 😉 This would be a huge win for folks working on adopting these new interfaces but have specific requirements for their clients/institutions. |
Description
The
block_editor_settings_all
filter is a fantastic way to curate the Editor experience in WordPress. One of its parameters is$block_editor_context
, which allows you to conditionally set various Editor settings based on the context, such as post type. However, in the Site Editor, the$block_editor_context
just returns:As more post types become editable in the Site Editor, we need a way to enable/disable Editor settings based on context within the Site Editor.
My hunch is that this will not be possible in PHP, and we will need a JavaScript method, which I think is possible, but I have not explored this fully. Therefore, I have labeled this issue as a Question rather than a Bug.
If anyone knows a rock-solid way to accomplish the code below in the Site Editor using JavaScript, please add the code in the comments, and I will update the Curating the Editor documentation.
Step-by-step reproduction instructions
Copy the following code into your theme's
functions.php
file.Screenshots, screen recording, code snippet
In the screenshots below, look closely and notice that the "lock" icon is disabled correctly in the Post Editor, but it's not disabled in the Site Editor.
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: