mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-30 02:54:04 +03:00
fixed hotkey IDs for profiles with "." in name - fixes #4367
This commit is contained in:
parent
9fbf9136fc
commit
dfdb3b051b
@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ProfilesService } from './services/profiles.service'
|
||||
import { HotkeyDescription, HotkeyProvider } from './api/hotkeyProvider'
|
||||
import { PartialProfile, Profile } from './api'
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
@ -193,9 +194,13 @@ export class AppHotkeyProvider extends HotkeyProvider {
|
||||
return [
|
||||
...this.hotkeys,
|
||||
...profiles.map(profile => ({
|
||||
id: `profile.${profile.id}`,
|
||||
id: `profile.${AppHotkeyProvider.getProfileHotkeyName(profile)}`,
|
||||
name: `New tab: ${profile.name}`,
|
||||
})),
|
||||
]
|
||||
}
|
||||
|
||||
static getProfileHotkeyName (profile: PartialProfile<Profile>): string {
|
||||
return profile.id!.replace(/\./g, '-')
|
||||
}
|
||||
}
|
||||
|
@ -151,8 +151,9 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
||||
|
||||
hotkeys.hotkey$.subscribe(async (hotkey) => {
|
||||
if (hotkey.startsWith('profile.')) {
|
||||
const id = hotkey.split('.')[1]
|
||||
const profile = (await profilesService.getProfiles()).find(x => x.id === id)
|
||||
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
||||
const profiles = await profilesService.getProfiles()
|
||||
const profile = profiles.find(x => AppHotkeyProvider.getProfileHotkeyName(x) === id)
|
||||
if (profile) {
|
||||
profilesService.openNewTabForProfile(profile)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user