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

Fixed: Fixed the issue that when use keyboard key to switch double tab #1221

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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
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
Loading