Skip to content

Commit

Permalink
Fixed: Fixed the issue that when use keyboard key to switch double tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoJiSen committed Jan 14, 2025
1 parent 7881cb8 commit 6c4b5fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/elements/content/content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {ElementCommandDialogComponent} from '@app/elements/content/command-dialo
import {ElementSendCommandWithVariableDialogComponent} from '@app/elements/content/send-command-with-variable-dialog/send-command-with-variable-dialog.component';
import {fromEvent, Subscription} from 'rxjs';
import * as jQuery from 'jquery/dist/jquery.min.js';
import * as _ from 'lodash';

@Component({
selector: 'elements-content',
Expand Down Expand Up @@ -92,6 +93,10 @@ export class ElementContentComponent implements OnInit, OnDestroy {
}

handleKeyDownTabChange() {
const debouncedSwitch = _.debounce((key: string) => {
this.viewSrv.keyboardSwitchTab(key);
}, 500);

this.keyboardSubscription = fromEvent(window, 'keydown').subscribe((event: any) => {
if (event.altKey && event.shiftKey && (event.key === 'ArrowRight' || event.key === 'ArrowLeft') && this.viewList.length > 1) {
let key = '';
Expand All @@ -100,7 +105,7 @@ export class ElementContentComponent implements OnInit, OnDestroy {
} else if (event.key === 'ArrowLeft') {
key = 'alt+shift+left';
}
this.viewSrv.keyboardSwitchTab(key);
debouncedSwitch(key);
}
});
}
Expand Down

0 comments on commit 6c4b5fd

Please sign in to comment.