-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Experiment: Add revisions panel to templates, template parts and patterns #77008
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,13 @@ const SidebarContent = ( { | |
| <PluginDocumentSettingPanel.Slot /> | ||
| <TemplateContentPanel /> | ||
| { window?.__experimentalDataFormInspector && | ||
| [ 'post', 'page' ].includes( postType ) && ( | ||
| [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small practical thing: can we have this logic in a single place? The sidebar component could be that place, which means we move these checks to the sidebar. By doing the above, the bigger question is more obvious. How do we absorb all the parts of the inspector into the view config endpoint? Right now, it only provides the DataForm config for the summary. What are the blockers, if any, to provide config for every panel?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Tracked this at #76076 as "Centralize logic to load experiment in the sidebar component (conversation)."
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is connected with a conversation I had with @mcsf that's tracked #76544
This is the case here as well: revisions are not an entity, but a feature of an entity. Alternatives we discussed are:
In both cases, we'd have two requests to the endpoint to retrieve the data we need (summary and revisions of the entity).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or, given this premise: revisions are not an entity, but a feature of an entity, we add
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I encountered part of what you describe (1:1 match) in this PR where we want a template to have a form for site settings and even for a different page altogether (see blog title). I used different forms in that case and I think that's something the consumer should need to handle per use case - for us it was
If I'm understanding right, you'd like to have a way for the view config endpoint to return panels too? |
||
| 'post', | ||
| 'page', | ||
| 'wp_template', | ||
| 'wp_template_part', | ||
| 'wp_block', | ||
| ].includes( postType ) && ( | ||
| <> | ||
| <TemplateActionsPanel /> | ||
| <PostRevisionsPanel /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,8 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { | ||
| __experimentalVStack as VStack, | ||
| ExternalLink, | ||
| } from '@wordpress/components'; | ||
| import { __experimentalVStack as VStack } from '@wordpress/components'; | ||
| import { useSelect } from '@wordpress/data'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { addQueryArgs } from '@wordpress/url'; | ||
|
|
||
| /** | ||
| * Internal dependencies | ||
|
|
@@ -41,18 +36,6 @@ import PostTrash from '../post-trash'; | |
| */ | ||
| const PANEL_NAME = 'post-status'; | ||
|
|
||
| export function OpenRevisionsClassicScreen( { revisionId } ) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is not related to the revisions panel, but it's a leftover I noticed now, from my previous refactoring when I created PostRevisionSummary. |
||
| return ( | ||
| <ExternalLink | ||
| href={ addQueryArgs( 'revision.php', { | ||
| revision: revisionId, | ||
| } ) } | ||
| > | ||
| { __( 'Open classic revisions screen' ) } | ||
| </ExternalLink> | ||
| ); | ||
| } | ||
|
|
||
| export default function PostSummary( { onActionPerformed } ) { | ||
| const postType = useSelect( | ||
| ( select ) => select( editorStore ).getCurrentPostType(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.