-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Patterns page: add edit & view revision actions to parts #60659
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: +49 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.
Works nicely.
As a follow-up it could be neat to include the revisions count as a suffix.
const actions = useMemo( () => { | ||
if ( type === TEMPLATE_PART_POST_TYPE ) { | ||
return [ | ||
editAction, |
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 looked into making the editAction
also available to user patterns. I haven't done so in this PR because the edit action eligibility check is post type agnostic and lives in the @wordpress/editor
package.
If there's interest I can look into that separately. We'd need to either exclude theme patterns from there or create a specific edit action for user patterns in the site editor package.
} ); | ||
} | ||
}, | ||
[ history ] |
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 missing deps 'categoryId' and 'type', or was it intentional?
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.
Oh, thanks for raising, fix at #60784
I'm trying to test this out in the Gutenberg 18.2 RC1 that was released on Friday. I'm not able to access anything with the testing instructions: "Visit the Patterns and go down to template parts. Verify that template parts have two new actions available (edit & view revisions) and they work as expected." So far I've tried the following scenarios thinking they might help:
Here are the steps I'm trying for each scenario:
FWIW - I'm seeing the 'Edit', and just not 'View Revisions' 🤔 |
@colorful-tones One quirk of the implementation is that the revisions will only be accessible when there's something in the database to revert to. So for theme-supplied assets that means you have to edit them twice. This is because the revisions UI in wp-admin isn't able to entertain the .html files supplied by themes. |
Part of #55083
Related #59659 #60359
What?
Add the
edit
andviewRevision
actions to template parts in the patterns page.Why?
These actions are available for Template Parts in the "Manage all template parts" screen. We aim to remove that screen, and one of the previous steps is to migrate all that behavior to the "Patterns" screen.
How?
Testing Instructions
Visit the Patterns and go down to template parts. Verify that template parts have two new actions available (edit & view revisions) and they work as expected.