-
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
Command tool: Add searchLabel property to commands #50663
Conversation
Size Change: +52 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
* @property {Function} callback Command callback. | ||
* @property {string} name Command name. | ||
* @property {string} label Command label. | ||
* @property {string=} searchLabel Command label. |
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 use a labels
object similar to the post types ones etc..? We had a similar discussion for the media inserter API.
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 the common case is to have a label for each command and the search one is optional and rarely used so I prefer this approach personally.
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.
If we don't expect any more labels in the future, it's okay yes.
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
Related to #50407
What?
We're using the following library for the command center. The library requires that each command has a unique "value" prop. Also, the library relies on that prop for its "search" algorithm. This has two implications:
To address this I'm using the command "label" by default for that prop and in the cases where the label is not sufficient for the unique constraint, one can provide a "searchLabel" property in addition to the default "label" one.
Testing Instructions
1- Create a page and a template with the same name
2- Ensure the command center still works properly when searching for these.