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
Fix rendering PluginTemplateSettingPanel when we're editing a template #60215
Fix rendering PluginTemplateSettingPanel when we're editing a template #60215
Conversation
Size Change: +25 B (0%) Total Size: 1.72 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.
Thanks, Nik! The fix works as expected.
Here's the code I used for testing:
const { createElement: el } = wp.element;
const registerPlugin = wp.plugins.registerPlugin;
const PluginTemplateSettingPanel = wp.editSite.PluginTemplateSettingPanel;
function TestPluginTemplateSettingPanel() {
return el(
PluginTemplateSettingPanel,
{},
el( 'p', {}, `Hello templates!` )
);
}
registerPlugin( 'test-post-publish-panel', {
icon: 'smiley',
render: TestPluginTemplateSettingPanel,
} );
@@ -115,6 +116,7 @@ export default function TemplatePanel() { | |||
> | |||
<TemplateAreas /> | |||
</PostCardPanel> | |||
<PluginTemplateSettingPanel.Slot /> |
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.
Should we move the slot below the "Transform into:" panel to retain the same position as on the trunk
?
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 think not because initially was below the 'template card' and that changed unintentionally.. If someone reports something, we could revisit. The goal though would be to use PluginDocumentSettingPanel
eventually.
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.
Makes sense 👍
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. |
WordPress#60215) Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
WordPress#60215) Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
In #50257 we introduced a new slot in Template Sidebar below the main information like the Template Card. At some point when we added the ability to also edit the page, this slot would render in both cases(page and template) which was not the intent.
Discussions have started about how to migrate it's usage and use internally PluginDocumentSettingPanel, but for now we can fix the rendering.
Testing Instructions
Code example: