mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-23 21:09:52 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
import { Component, HostListener, Input } from '@angular/core'
|
|
import { AppService, SplitTabComponent } from 'tabby-core'
|
|
import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component'
|
|
|
|
/** @hidden */
|
|
@Component({
|
|
selector: 'terminal-toolbar',
|
|
template: require('./terminalToolbar.component.pug'),
|
|
styles: [require('./terminalToolbar.component.scss')],
|
|
})
|
|
export class TerminalToolbarComponent {
|
|
@Input() tab: BaseTerminalTabComponent
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
constructor (
|
|
private app: AppService,
|
|
) { }
|
|
|
|
onTabDragStart (): void {
|
|
this.app.emitTabDragStarted(this.tab)
|
|
}
|
|
|
|
onTabDragEnd (): void {
|
|
setTimeout(() => {
|
|
this.app.emitTabDragEnded()
|
|
this.app.emitTabsChanged()
|
|
})
|
|
}
|
|
|
|
get shouldShowDragHandle (): boolean {
|
|
return this.tab.parent instanceof SplitTabComponent && this.tab.parent.getAllTabs().length > 1
|
|
}
|
|
|
|
@HostListener('mouseenter') onMouseEnter () {
|
|
this.tab.showToolbar()
|
|
}
|
|
|
|
@HostListener('mouseleave') onMouseLeave () {
|
|
this.tab.hideToolbar()
|
|
}
|
|
}
|