mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 18:36:15 -08:00
feat: add ctrl+f as hotkey to focus search field
This commit is contained in:
1 parent
4abaeae8c2
commit
cad162dc67
2 files changed
+19
-1
No files matched your search
@@ -4,6 +4,7 @@
|
|||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<input
|
<input
|
||||||
|
#search
|
||||||
matInput
|
matInput
|
||||||
placeholder="Search channel ({{
|
placeholder="Search channel ({{
|
||||||
_channelList?.length
|
_channelList?.length
|
||||||
|
|||||||
+18
-1
@@ -1,4 +1,10 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
ElementRef,
|
||||||
|
HostListener,
|
||||||
|
Input,
|
||||||
|
ViewChild,
|
||||||
|
} from '@angular/core';
|
||||||
import { Channel, ChannelStore, ChannelQuery } from '../../../state';
|
import { Channel, ChannelStore, ChannelQuery } from '../../../state';
|
||||||
|
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -44,6 +50,17 @@ export class ChannelListContainerComponent {
|
|||||||
name: '',
|
name: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Search field element */
|
||||||
|
@ViewChild('search') searchElement: ElementRef;
|
||||||
|
|
||||||
|
/** Register ctrl+f as keyboard hotkey to focus the search input field */
|
||||||
|
@HostListener('document:keypress', ['$event'])
|
||||||
|
handleKeyboardEvent(event: KeyboardEvent): void {
|
||||||
|
if (event.key === 'f' && event.ctrlKey) {
|
||||||
|
this.searchElement.nativeElement.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of ChannelListContainerComponent
|
* Creates an instance of ChannelListContainerComponent
|
||||||
* @param channelQuery akita's channel query
|
* @param channelQuery akita's channel query
|
||||||
|
|||||||
Reference in new issue
Block a user