Add Ctrl+F handling to Channel search bar

This commit is contained in:
Jason Henriquez 2024-04-20 08:33:01 -05:00
parent fa1cd3632e
commit 7337fe1d1b
2 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import autolinker from 'autolinker'
import {
setPublishedTimestampsInvidious,
copyToClipboard,
ctrlFHandler,
extractNumberFromString,
formatNumber,
showToast
@ -434,6 +435,7 @@ export default defineComponent({
},
mounted: function () {
this.isLoading = true
document.addEventListener('keydown', this.keyboardShortcutHandler)
if (this.$route.query.url) {
this.resolveChannelUrl(this.$route.query.url, this.$route.params.currentTab)
@ -460,6 +462,9 @@ export default defineComponent({
})
}
},
beforeDestroy() {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
resolveChannelUrl: async function (url, tab = undefined) {
let id
@ -1950,6 +1955,10 @@ export default defineComponent({
})
},
keyboardShortcutHandler: function (event) {
ctrlFHandler(event, this.$refs.channelSearchBar)
},
...mapActions([
'showOutlines',
'updateSubscriptionDetails',

View File

@ -206,6 +206,7 @@
<ft-input
v-if="showSearchBar"
ref="channelSearchBar"
:placeholder="$t('Channel.Search Channel')"
:show-clear-text-button="true"
class="channelSearch"