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
Trigger text diff search plugin even when CodeMirror doesn't have focus #7899
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
niik
added
the
ready-for-review
Pull Requests that are ready to be reviewed by the maintainers
label
Jul 2, 2019
outofambit
moved this from Needs to be Prioritized
to ⭐️ PR Reviewable Priority ⭐️
in PR Priority
Jul 2, 2019
outofambit
approved these changes
Jul 2, 2019
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! just one question about labelling
tierninho
approved these changes
Jul 2, 2019
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.
Testing notes:
- cmd-F is functional with Edit menu option intact
- Search box opens regardless of what element is in focus
- search box opens on text files only; binary files ignored
- search box opens on diffs accessed from Stash, Changes, History, Compare branches
- search box opens on new files, edited files, and deleted files
4663fe9, mac
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
We shipped #7866 in 2.1.0. One limitation of the implementation there is that since CodeMirror is responsible for handling the keyboard shortcut it will never trigger unless the editor is focused (this was described in #7866).
Description
This PR adds a menu item under the Edit menu which dispatches a custom event (similar to how we deal with select-all). The
TextDiff
component then registers an event handler on the document node allowing it to catch CmdOrCtrl+F regardless of what element is in focus. If one or more components are active and subscribing to this event the first one to register will get the opportunity to handle it first. Right now there are only ever one text diff active in the app at any given time so that's okay.In the future we might want to either de-scope the focus area or have other component do so but we'll cross that bridge if and when we get there.
Release notes
Notes: no-notes