This commit is contained in:
Eugene Pankov 2017-05-13 12:33:53 +02:00
parent 6cb5351460
commit 791822be12
3 changed files with 8 additions and 7 deletions

View File

@ -24,7 +24,7 @@ title-bar(
.btn-group .btn-group
button.btn.btn-secondary.btn-tab-bar( button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of getLeftToolbarButtons()', *ngFor='let button of leftToolbarButtons',
[title]='button.title', [title]='button.title',
(click)='button.click()', (click)='button.click()',
) )
@ -34,7 +34,7 @@ title-bar(
.btn-group .btn-group
button.btn.btn-secondary.btn-tab-bar( button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of getRightToolbarButtons()', *ngFor='let button of rightToolbarButtons',
[title]='button.title', [title]='button.title',
(click)='button.click()', (click)='button.click()',
) )

View File

@ -44,6 +44,8 @@ export class AppRootComponent {
toasterConfig: ToasterConfig toasterConfig: ToasterConfig
Platform = Platform Platform = Platform
@Input() ready = false @Input() ready = false
@Input() leftToolbarButtons: IToolbarButton[]
@Input() rightToolbarButtons: IToolbarButton[]
private logger: Logger private logger: Logger
constructor ( constructor (
@ -68,6 +70,9 @@ export class AppRootComponent {
timeout: 4000, timeout: 4000,
}) })
this.leftToolbarButtons = this.getToolbarButtons(false)
this.rightToolbarButtons = this.getToolbarButtons(true)
this.hotkeys.matchedHotkey.subscribe((hotkey) => { this.hotkeys.matchedHotkey.subscribe((hotkey) => {
if (hotkey.startsWith('tab-')) { if (hotkey.startsWith('tab-')) {
let index = parseInt(hotkey.split('-')[1]) let index = parseInt(hotkey.split('-')[1])
@ -126,10 +131,6 @@ export class AppRootComponent {
} }
} }
getLeftToolbarButtons (): IToolbarButton[] { return this.getToolbarButtons(false) }
getRightToolbarButtons (): IToolbarButton[] { return this.getToolbarButtons(true) }
async ngOnInit () { async ngOnInit () {
await this.tabRecovery.recoverTabs() await this.tabRecovery.recoverTabs()
this.ready = true this.ready = true

View File

@ -115,7 +115,7 @@ export class HotkeysService {
for (let sequence of this.getHotkeysConfig()[id]) { for (let sequence of this.getHotkeysConfig()[id]) {
let currentStrokes = this.getCurrentKeystrokes() let currentStrokes = this.getCurrentKeystrokes()
if (currentStrokes.length < sequence.length) { if (currentStrokes.length < sequence.length) {
break continue
} }
if (sequence.every((x, index) => { if (sequence.every((x, index) => {
return x.toLowerCase() === currentStrokes[currentStrokes.length - sequence.length + index].toLowerCase() return x.toLowerCase() === currentStrokes[currentStrokes.length - sequence.length + index].toLowerCase()