-
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
Editor: Introduce PluginPostExcerpt slot #55200
Conversation
Size Change: +77 B (0%) Total Size: 1.65 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, @retrofox!
Do you know if this extensibility has been requested before?
The project has been strict on introducing new SlotFills in the past, and this request feels to be meeting very specific needs.
Hi, there!
Slightly talked with @mtias about it. |
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 looking great and working well!
I've left some minor suggestions, but nothing blocking I'd say.
Nice work 🚀
packages/edit-post/src/components/sidebar/plugin-post-excerpt/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/plugin-post-excerpt/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/plugin-post-excerpt/test/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/plugin-post-excerpt/test/__snapshots__/index.js.snap
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/post-excerpt/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/post-excerpt/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/post-excerpt/index.js
Outdated
Show resolved
Hide resolved
What a shame those typos. Thanks!
✋ |
96c4372
to
511e578
Compare
…index.js Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
…index.js Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
…test/index.js Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
… of the editor (#55149) * ColorPicker: expose drag start / end handlers via context * ColorPicker: remove overflow hidden rule * Dropdown: add some sort of backdrop to capture pointer events * Add test story * Prevent resizing on color palette's popover, which also triggers overflow: hidden * Improve backdrop position by using react portal * Cleanup * Aria-hidden * Cleanup * Scope querySelector within color picker s container element * Listen for drag events also on hue and alpha sliders * Remove temporary styles * Remove temporary storybook example * CHANGELOG * Move pointer events trap from Dropdown to Popover component * Use state to grab ColorPicker's container element to make sure the component re-renders * Remove overflow:hidden from PaletteEdit component's popover * Update CHANGELOG * Remove dead code * Update snapshot * Move newly added ColorPicker logic to a separate hook * Add inline comment around the resize: false change * Add more comments
511e578
to
50974a6
Compare
While I don't have a strong opinion for this enhancement to be merged, I think there're still some open questions - #55200 (review). |
👋
I don't know.
I think the Excerpt panel can now be extended beyond this case, which could also benefit other cases.
IMHO, extending other panels such as Categories, Tags, etc should be possible, too. I've merged the PR because I thought having a ✅ was enough. Is it ok? |
No issues with merging this specific case 👍 I wish we just had more general solution/approach for extending these panels. |
More general in which sense? Also, the data handling is guaranteed by using the store. |
A general API that can enhance or replace any document panel. Currently, solutions are mixed; some panels allow overriding main components via filters (taxonomies, post thumbnail), and now this allows injecting components via SlotFills. P.S. Here's an ongoing discussion regarding extensibility: #37448. |
I see. Thanks for sharing the issue. Very useful. I'll take a look. |
I agree with @Mamaduka here, this feels a bit rushed. Also, why did we use experimental prefix, we stopped using these prefixes. It's either public or private now. |
Dev NoteIntroduction of the PluginPostExcerpt Slot ComponentThis update introduces a new slot component within the Gutenberg editor. This enhancement allows for the extension of the Post Excerpt panel, allowing developers to customize this area for their needs. What's New?The component enables the addition of custom content within the Post Excerpt panel. This is particularly useful for plugins looking to add extra functionality or information specific to their use case. UsageTo utilize this new feature, developers can now insert their custom content into the Post Excerpt panel by creating a component that leverages the slot. This allows for a seamless integration of custom functionalities directly within the editor. The following example shows adding custom content to the post excerpt panel. import { PluginPostExcerpt } from '@wordpress/edit-post';
import { __ } from '@wordpress/i18n';
const MyPluginPostExcerpt = () => (
<PluginPostExcerpt
className="my-plugin-post-excerpt"
>
{ __( 'Post excerpt custom content' ) }
</PluginPostExcerpt>
); |
How should we continue to address potential issues here? After this change to the component name, it still seems to be prefixed with |
This just cost me a few hours of my life that I won't get back! Finally checked the source code after trying everything else I could think of, and you have to use It's confusing because the docs are wrong (https://make.wordpress.org/core/2024/03/09/miscellaneous-editor-changes-in-wordpress-6-5/#introduction-of-the-pluginpostexcerpt-slot-component) and I was working in an unfamilar codebase so wasn't sure if it was an issue with the build process as the error was very cryptic:
|
Created a follow-up #61188 |
I'm sorry to hear that. That isn't good at all. :-( Additionally, #61188 has been merged, meaning the |
What?
This PR introduces the
<PluginPostExcerpt />
slot component to extend the Post Excerpt panel.Why?
Because I'd like to be able to extend the excerpt panel. For instance, this Jetpack plugin PR enhances the panel with AI Assistance: Automattic/jetpack#33529
How?
By using the Slot&Fill core API \m/
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast