mirror of
https://github.com/Eugeny/tabby
synced 2024-12-13 14:52:45 +00:00
wip fix(core): Cannot access 'ProfilesService' before initialization from AppHotkeyProvider
This commit is contained in:
parent
8e9156e250
commit
ef040ee342
2 changed files with 2 additions and 6 deletions
|
@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'
|
||||||
import { TranslateService } from '@ngx-translate/core'
|
import { TranslateService } from '@ngx-translate/core'
|
||||||
import { ProfilesService } from './services/profiles.service'
|
import { ProfilesService } from './services/profiles.service'
|
||||||
import { HotkeyDescription, HotkeyProvider } from './api/hotkeyProvider'
|
import { HotkeyDescription, HotkeyProvider } from './api/hotkeyProvider'
|
||||||
import { PartialProfile, Profile } from './api'
|
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -268,7 +267,7 @@ export class AppHotkeyProvider extends HotkeyProvider {
|
||||||
return [
|
return [
|
||||||
...this.hotkeys,
|
...this.hotkeys,
|
||||||
...profiles.map(profile => ({
|
...profiles.map(profile => ({
|
||||||
id: `profile.${AppHotkeyProvider.getProfileHotkeyName(profile)}`,
|
id: `profile.${ProfilesService.getProfileHotkeyName(profile)}`,
|
||||||
name: this.translate.instant('New tab: {profile}', { profile: profile.name }),
|
name: this.translate.instant('New tab: {profile}', { profile: profile.name }),
|
||||||
})),
|
})),
|
||||||
...this.profilesService.getProviders().map(provider => ({
|
...this.profilesService.getProviders().map(provider => ({
|
||||||
|
@ -278,7 +277,4 @@ export class AppHotkeyProvider extends HotkeyProvider {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
static getProfileHotkeyName (profile: PartialProfile<Profile>): string {
|
|
||||||
return (profile.id ?? profile.name).replace(/\./g, '-')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
||||||
if (hotkey.startsWith('profile.')) {
|
if (hotkey.startsWith('profile.')) {
|
||||||
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
||||||
const profiles = await profilesService.getProfiles()
|
const profiles = await profilesService.getProfiles()
|
||||||
const profile = profiles.find(x => AppHotkeyProvider.getProfileHotkeyName(x) === id)
|
const profile = profiles.find(x => ProfilesService.getProfileHotkeyName(x) === id)
|
||||||
if (profile) {
|
if (profile) {
|
||||||
profilesService.openNewTabForProfile(profile)
|
profilesService.openNewTabForProfile(profile)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue