-
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
Packages: Extract edit post package #8958
Conversation
16b875b
to
f7fe9f6
Compare
So let's think about what each package is and see how this PR fits: 1- The 2- The In the current PR, we're exposing some parts of
I think it's probably too soon to make such a decision (whether these components are implementation details or should be reused across implementations). I'd be in favor of waiting for alternative implementations to emerge and see if they really need these components or it's just a gain of time. |
Let me disagree with this statement. All those components listed are part of the public API, too. They are already exposed as part of BTW, I'm surprised |
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 tend to agree with @gziolo here. As plugin developers, we should have full access to edit-post
and its innerworkings, so I'd expect they're part of the public API.
To be honest, I was surprised to see that there's no edit-post
package back when I was working on Automattic/wp-calypso#26603 - in this one we had to still rely on the global wp
variable.
I understand this is already an implementation of the editor, meant to be used in wp-admin, but I think this shouldn't be a strict limitation - we can always make edit-post
work in a synthetic environment emulates wp-admin but is different than it - I recall working on custom dashboards before, and if I wanted to embed Gutenberg there, I'd definitely start from implementing it in a similar way to how it's done in wp-admin.
|
||
const { Fill: PluginsBlockSettingsMenuGroup, Slot } = createSlotFill( 'PluginsBlockSettingsMenuGroup' ); | ||
|
||
PluginsBlockSettingsMenuGroup.Slot = ( { fillProps } ) => { |
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.
It feels a little odd to have PluginsBlockSettingsMenuGroup
and PluginBlockSettingsMenuItem
being parts of different packages - could you please clarify the rationale behind that decision?
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.
PluginBlockSettingsMenuItem
is just one of the implementation of the PluginsBlockSettingsMenuGroup
fill. In fact, it is a wrapper which enforces consistency across all menu items added in edit-post
. My reasoning is that this slot is general purpose for all editor
implementations. The same applies for other slots like InspectorControls
and BlockControls
- they only define the place where plugins can put they fills, they don't have any opinions. You could use them directly as it happens with blocks and their definitions, but using an abstraction will help us to apply those block settings only in edit-post
context. It is still possible to use PluginsBlockSettingsMenuGroup
fill directly, but this is going to be a bit more complex.
I'm happy to discuss it further, this is something that needs some more thought as this is something that might have implications in the future if we don't limit its usage by scoping it.
For the better context, we already did some exploration for edit-template
page which would allow you to use blocks to build your own page template. This is why I'm not sold on the idea of having specialized implementations inside editor
package as they might show up in the context some plugin developers didn't intend to. It's safer to assume all plugins are applied to edit-post
as of today and move it up to editor
in the future than the other way around.
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.
Gotcha, thanks for clarifying 👍
f2e23a8
to
9b859a8
Compare
|
@youknowriad took a different approach in #10429 which moves all code from |
Description
Partially addresses #8421.
There are no breaking changes so far even though this PR has some refactorings:
PluginsBlockSettingsMenuGroup
and move toeditor
package -PluginBlockSettingsMenuItem
was an internal component inedit-post
so couldn't be really used.PluginBlockSettingsMenuItem
to align with docs - we need to decide whether we should fix docs instead.Testing
Example plugins for the following components can be found inside e2e tests folder:
PluginPostPublishPanel
PluginPrePublishPanel
PluginPostStatusInfo
(it is covered by actual e2e test case)The easiest way to test it is to use docker image for e2e tests and activate manually the following plugin:
Gutenberg Test Plugin, Plugins API
and ensure that they work as expected.TODO
@wordpress/edit-post
package.PluginBlockSettingsMenuItem
PluginPostPublishPanel
PluginPostStatusInfo
PluginPrePublishPanel
- this should be its own PRPluginSidebarMoreMenuItem
- this should be its own PRPluginsMoreMenuGroup
- this should be its own PRPluginSidebar
- moved toPinnedPlugins
@wordpress/plugins
(Plugins: Move PinnedPlugins component #9312)PluginsBlockSettingsMenuGroup
and move toeditor
package.PluginBlockSettingsMenuItem
to align with docs.@wordpress/edit-post
package.- this should be its own PRactiveGeneralSidebar
- moved topinnedPluginItems
@wordpress/plugins
(Plugins: Move PinnedPlugins component #9312)store reference- this should be its own PR