Skip to content
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(UnifiedSearch): Restore ctrl+f activates unified search #46120

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion core/src/views/UnifiedSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import Magnify from 'vue-material-design-icons/Magnify.vue'
import UnifiedSearchModal from './UnifiedSearchModal.vue'
import logger from '../logger.js'

export default {
name: 'UnifiedSearch',
Expand All @@ -34,7 +35,11 @@ export default {
}
},
mounted() {
console.debug('Unified search initialized!')
logger.info('Unified search initialized!')
window.addEventListener('keydown', this.handleKeyDown)
},
beforeDestroy() {
window.removeEventListener('keydown', this.handleKeyDown)
},
methods: {
toggleUnifiedSearch() {
Expand All @@ -43,6 +48,16 @@ export default {
handleModalVisibilityChange(newVisibilityVal) {
this.showUnifiedSearch = newVisibilityVal
},
handleKeyDown(event) {
// if not already opened, allows us to trigger default browser on second keydown
if (event.ctrlKey && event.code === 'KeyF' && !this.showUnifiedSearch) {
event.preventDefault()
this.showUnifiedSearch = true
} else if (event.ctrlKey && event.key === 'f' && this.showUnifiedSearch) {
nfebe marked this conversation as resolved.
Show resolved Hide resolved
// User wants to use the native browser search, so we close ours again
this.showUnifiedSearch = false
}
},
},
}
</script>
Expand Down
Loading