Merge branch 'master' into persistence

This commit is contained in:
Eugene Pankov
2018-12-21 20:04:49 +01:00
7 changed files with 33 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { SortableComponent } from 'ng2-dnd'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { BaseTabComponent } from './baseTab.component'
import { RenameTabModalComponent } from './renameTabModal.component'
import { HotkeysService } from '../services/hotkeys.service'
import { ElectronService } from '../services/electron.service'
import { AppService } from '../services/app.service'
import { HostAppService, Platform } from '../services/hostApp.service'
@@ -38,8 +39,17 @@ export class TabHeaderComponent {
private zone: NgZone,
private hostApp: HostAppService,
private ngbModal: NgbModal,
private hotkeys: HotkeysService,
private parentDraggable: SortableComponent,
) { }
) {
this.hotkeys.matchedHotkey.subscribe((hotkey) => {
if (this.app.activeTab === this.tab) {
if (hotkey === 'rename-tab') {
this.showRenameTabModal()
}
}
})
}
ngOnInit () {
if (this.hostApp.platform === Platform.macOS) {
@@ -50,7 +60,7 @@ export class TabHeaderComponent {
})
}
@HostListener('dblclick') onDoubleClick (): void {
showRenameTabModal (): void {
let modal = this.ngbModal.open(RenameTabModalComponent)
modal.componentInstance.value = this.tab.customTitle || this.tab.title
modal.result.then(result => {
@@ -59,6 +69,10 @@ export class TabHeaderComponent {
}).catch(() => null)
}
@HostListener('dblclick') onDoubleClick (): void {
this.showRenameTabModal()
}
@HostListener('auxclick', ['$event']) async onAuxClick ($event: MouseEvent) {
if ($event.which === 2) {
this.app.closeTab(this.tab, true)
@@ -97,6 +111,10 @@ export class TabHeaderComponent {
}
})
},
{
label: 'Rename',
click: () => this.zone.run( () => this.showRenameTabModal() )
},
{
label: 'Color',
sublabel: COLORS.find(x => x.value === this.tab.color).name,