-
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
Enable template preview in post editor for non administrators #60447
Enable template preview in post editor for non administrators #60447
Conversation
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: +61 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@getdave I'd love to get your take on this. I feel like there has to be a better way to do this.
essentially what we want here is a preview-only mode of the navigation block that readers a full rich preview of the navigation menu in question for any users that are able to view the item in the rest API but cannot edit it.
We recently added this same thing to the template part block in #60326
packages/editor/src/components/provider/disable-non-page-content-blocks.js
Outdated
Show resolved
Hide resolved
return { | ||
template: | ||
supportsTemplateMode && | ||
isViewable && | ||
canEditTemplate && | ||
canViewTemplate && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is potentially the most impactful change because it's not clear exactly what the availability of the template changes in the editor.
7e095bd
to
bd076c1
Compare
bd076c1
to
0eb074a
Compare
@youknowriad I cut this down to only include the most fundamental changes. The additional updates to the template part block were moved here: #60787 And a new issue for the Navigation block was created #60809 Let me know if you want me to change anything else here or whether you agree this is ready to get merged :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work here. This looks good.
const _canEditTemplate = | ||
select( coreStore ).canUser( 'create', 'templates' ) ?? false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check correct? Should it check if a user can edit templates or template parts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mamaduka As far as I know they use one singular REST Controler for both. And that lives under templates
🤔
I may of course have missed something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have different rest bases - templates
and template-parts
.
I'm asking because I'm working to bulk update canUser
selectors, and I would instead use the correct post type for new checks. See #63415.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated to the correct entity in #63415.
What?
Closing #60316. Supersedes #58301 and follows #60317 & #60326
Why?
To allow non administrators to preview templates whilst editing content in the regular post editor
How?
Adjusting the conditions when to display templates to allow users that can only view templates to still preview them.
Testing Instructions