mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-08 21:40:03 +00:00
added drag handles to toolbars
This commit is contained in:
parent
448fe29f50
commit
8b5b53ab26
@ -149,6 +149,7 @@ const PROVIDERS = [
|
|||||||
SortablejsModule,
|
SortablejsModule,
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
|
CdkAutoDropGroup,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
.content(
|
||||||
|
cdkDropList
|
||||||
|
cdkAutoDropGroup='app-tabs'
|
||||||
|
)
|
||||||
|
i.fas.fa-grip-vertical.drag-handle(
|
||||||
|
*ngIf='shouldShowDragHandle',
|
||||||
|
cdkDrag,
|
||||||
|
[cdkDragData]='tab',
|
||||||
|
(cdkDragStarted)='onTabDragStart()',
|
||||||
|
(cdkDragEnded)='onTabDragEnd()'
|
||||||
|
)
|
||||||
|
|
||||||
ng-content
|
ng-content
|
||||||
|
|
||||||
button.btn.btn-sm.btn-link(
|
button.btn.btn-sm.btn-link(
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
:host {
|
:host {
|
||||||
background: rgba(0, 0, 0, .75);
|
background: #000000bf;
|
||||||
padding: 5px 15px 5px 15px;
|
padding: 5px 15px 5px 15px;
|
||||||
|
display: flex;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 3;
|
}
|
||||||
|
|
||||||
|
.drag-handle {
|
||||||
|
margin: 0 10px 0 0;
|
||||||
|
cursor: move;
|
||||||
|
opacity: .3;
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep .btn {
|
::ng-deep .btn {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
import { Component, HostListener, Input } from '@angular/core'
|
import { Component, HostListener, Input } from '@angular/core'
|
||||||
|
import { AppService, SplitTabComponent } from 'tabby-core'
|
||||||
import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component'
|
import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@ -11,6 +12,26 @@ import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component'
|
|||||||
export class TerminalToolbarComponent {
|
export class TerminalToolbarComponent {
|
||||||
@Input() tab: BaseTerminalTabComponent
|
@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 () {
|
@HostListener('mouseenter') onMouseEnter () {
|
||||||
this.tab.showToolbar()
|
this.tab.showToolbar()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user