-
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
Marks the selectors and actions of the commands store as a public API #51169
Conversation
Size Change: -30 B (0%) Total Size: 1.39 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.
Looks good, thanks!
daad3a8
to
98c6c11
Compare
Is there a tracking issue for this @youknowriad or another place to see more details about why it isn't available? My understanding is that is what would block plugin from using it on our own admin pages? |
I don't understand the question. -- To detail more here, the API to create "custom contexts" is not something I'm confident making public yet. But also I don't think it's the most important API for third-party developers, plugins can add commands and command loaders to the command center. They can also add "contextual" commands (commands that show up automatically when you open the command center) to the contexts core defines. What they can't do is define their own contexts. |
I'm wondering what the path is to the API being public? Is it something we plan to have in place by 6.3 release?
Right. My use case is one of the plugins I work on has it's own React powered admin pages. We'd love to add a command center implementation to our own plugin page that would let users quickly take actions in our plugin. These actions aren't at all related to the Site Editor or Block Editor though. My understanding, is we'd need to define our own context to do that properly, but I may be misunderstanding the API. |
@TimothyBJacobs you should be able to use the command center in your own pages but without the "contextual commands" feature. So basically you'd search for all commands. I think at some point we'd probably open the custom context API too but right now, it's not something I'm confident about for forwards compatibility. So most likely something we could for 6.4, once have more feedback and experience with the command center. |
Aha! I understand, thanks @youknowriad! That seems reasonable to me. Thanks for clarifying! |
What?
There has been a clear interest from folks to have a direct access to the "store" API (selectors and actions) of the commands center to enable:
This Pr makes the "commandsStore" a public API like any other store but marks some specific actions of the store (setContext) as private. That one is something we don't want to open yet to third-parties.
Testing Instructions
1- Open the site editor
2- Check that the command center still works
3- Check that you can call selectors from the console
wp.data.select( wp.commands.store ).getCommands()