duplicated keys in search quick fix
This commit is contained in:
parent
36e621009b
commit
7ef028b5e3
@ -37,7 +37,6 @@ export class SpotlightSearchComponent {
|
|||||||
|
|
||||||
@HostListener('document:keyup', ['$event'])
|
@HostListener('document:keyup', ['$event'])
|
||||||
handleKeyDown(event: KeyboardEvent) {
|
handleKeyDown(event: KeyboardEvent) {
|
||||||
console.log(event);
|
|
||||||
if (event.code === 'ArrowDown' && this._actions) {
|
if (event.code === 'ArrowDown' && this._actions) {
|
||||||
this._currentActionIdx++;
|
this._currentActionIdx++;
|
||||||
return this._restoreFocusOnAction(this._currentActionIdx === this._actions.length);
|
return this._restoreFocusOnAction(this._currentActionIdx === this._actions.length);
|
||||||
@ -53,11 +52,13 @@ export class SpotlightSearchComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._actions.find((_, index) => index === this._currentActionIdx)?.nativeElement === document.activeElement) {
|
||||||
|
let query = this.formGroup.get('query').value as string;
|
||||||
|
if (event.code === 'Backspace') query = query.substring(0, query.length - 1);
|
||||||
|
else if (event.key.length === 1) query = query + event.key;
|
||||||
|
this.formGroup.patchValue({ query: query });
|
||||||
|
}
|
||||||
document.getElementById('query').focus();
|
document.getElementById('query').focus();
|
||||||
let query = this.formGroup.get('query').value as string;
|
|
||||||
if (event.code === 'Backspace') query = query.substring(0, query.length - 1);
|
|
||||||
else if (event.key.length === 1) query = query + event.key;
|
|
||||||
this.formGroup.patchValue({ query: query });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@debounce(50)
|
@debounce(50)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user