-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
feat: added global search suffix #12549
feat: added global search suffix #12549
Conversation
Signed-off-by: Lukas Frey <[email protected]>
Signed-off-by: Lukas Frey <[email protected]>
Signed-off-by: Lukas Frey <[email protected]>
…to feature/global-search-suffix
Signed-off-by: Lukas Frey <[email protected]>
…to feature/global-search-suffix
Signed-off-by: Lukas Frey <[email protected]>
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.
Good ideas, thanks!
However, I feel like there are two features rolled into this one method at the moment.
Let's keep globalSearchFieldSuffix()
(notice the name change) as just handling custom suffixes. Please rename the corresponding property and getter to match. The corresponding property can be nullable instead of accepting a bool, Then, a new method can be introduced as globalSearchKeyBindingsFieldSuffix()
, which just calls ->globalSearchFieldSuffix()
and passes a closure to return the keybindings based on the platform. Does that make sense?
Also, please refactor the platform to an enum. |
Will do :) Should this be an Enum in the
I see, makes sense! Shouldn't the method be rather called And the |
…nd field key bindings suffix methods Signed-off-by: Lukas Frey <[email protected]>
Signed-off-by: Lukas Frey <[email protected]>
…to feature/global-search-suffix
Sure, |
Also, can we have a new helper method in filament/support called |
Sounds good. I've added it. |
Signed-off-by: Lukas Frey <[email protected]>
Signed-off-by: Lukas Frey <[email protected]>
Thanks! |
Description
This PR adds the ability to add and modify the
suffix
of the global search field (if global search is enabled).By default, the newly added method
getGlobalSearchSuffix()
returns false. In this case it will behave like before the PR - no suffix will be rendered.You can enable the suffix using the
globalSearchSuffix()
method on the panel:It accepts one parameter which can be of three types:
platform
which contains the name of the platform parsed from the user-agent (described later on). This is useful if you want to display the key-binding differently for each platform, such asCtrl+K
on Windows, but⌘K
on Mac.platform
that was parsed from the user-agent to determine what to display. It will replace some OS-specific keys with the substitutes on other OSes according to mousetrap's documentation.Platform parsing from user-agent:
Currently there's a very simple check to determine the OS from the user-agent and currently it differentiates between:
So if you wanted to customize the suffix for each platform, you could do the following:
Visual changes
Functional changes
composer cs
command.