CodeMirror: make Cmd-f trigger search globally
Created by: oleggromov
Description
As we're approaching shipping CodeMirror-based blob view for everyone, we need to take care of Cmd/Ctrl-F behaviour. This diff adds it:
- as a global keyboard shortcut to
Layout
- theoretically, it should trigger search everywhere in the app, when the focus isn't hijacked and code mirror blob view is visible - to the SearchInput, as it has it's own hotkey handling - and we're triggering the CodeMirror search instead
Whenever search triggers, I am actually pressing Cmd-F
:
https://user-images.githubusercontent.com/2196347/186660156-43a7e00a-5c2b-4ec8-8d9c-f35e61498abf.mov
Test plan
- Run the app locally
- Set
enableCodeMirrorFileView
totrue
in settings - Check that with the focus inside the codemirror view, inside the search bar, or anywhere on the page Cmd-F triggers blob view search
- Check that outside the page with the blob view, it triggers browser's native search (unless hijacked by some other component)
- Toggle the setting off and check that the search isn't broken
App preview:
Check out the client app preview documentation to learn more.