mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-14 08:29:58 +00:00
Revert "prevent dropping a tab on itself - fixes #5580"
This reverts commit ceb1b59409eefca423140ef17f25ac83beee3496.
This commit is contained in:
parent
6e9f497d22
commit
c0988e58b4
@ -158,7 +158,6 @@ export type SplitDropZoneInfo = {
|
|||||||
></split-tab-spanner>
|
></split-tab-spanner>
|
||||||
<split-tab-drop-zone
|
<split-tab-drop-zone
|
||||||
*ngFor='let dropZone of _dropZones'
|
*ngFor='let dropZone of _dropZones'
|
||||||
[enabled]='dropZonesEnabled'
|
|
||||||
[parent]='this'
|
[parent]='this'
|
||||||
[dropZone]='dropZone'
|
[dropZone]='dropZone'
|
||||||
(tabDropped)='onTabDropped($event, dropZone)'
|
(tabDropped)='onTabDropped($event, dropZone)'
|
||||||
@ -604,10 +603,6 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
this.tabAdopted.next(tab)
|
this.tabAdopted.next(tab)
|
||||||
}
|
}
|
||||||
|
|
||||||
get dropZonesEnabled (): boolean {
|
|
||||||
return this.getAllTabs().length > 1
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy (): void {
|
destroy (): void {
|
||||||
super.destroy()
|
super.destroy()
|
||||||
for (const x of this.getAllTabs()) {
|
for (const x of this.getAllTabs()) {
|
||||||
|
@ -23,32 +23,22 @@ import { SplitDropZoneInfo } from './splitTab.component'
|
|||||||
export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
||||||
@Input() dropZone: SplitDropZoneInfo
|
@Input() dropZone: SplitDropZoneInfo
|
||||||
@Input() parent: BaseTabComponent
|
@Input() parent: BaseTabComponent
|
||||||
@Input() enabled = false
|
|
||||||
@Output() tabDropped = new EventEmitter<BaseTabComponent>()
|
@Output() tabDropped = new EventEmitter<BaseTabComponent>()
|
||||||
@HostBinding('class.active') isActive = false
|
@HostBinding('class.active') isActive = false
|
||||||
@HostBinding('class.highlighted') isHighlighted = false
|
@HostBinding('class.highlighted') isHighlighted = false
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||||
constructor (
|
constructor (
|
||||||
element: ElementRef,
|
element: ElementRef,
|
||||||
app: AppService,
|
app: AppService,
|
||||||
) {
|
) {
|
||||||
super(element)
|
super(element)
|
||||||
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
||||||
this.isActive = !!(tab && this.canActivateFor(tab))
|
this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container.children[this.dropZone.position])
|
||||||
this.layout()
|
this.layout()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateFor (tab: BaseTabComponent) {
|
|
||||||
if (tab === this.parent || !this.enabled) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (this.dropZone.type === 'absolute' && tab === this.dropZone.container.children[this.dropZone.position]) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges () {
|
ngOnChanges () {
|
||||||
this.layout()
|
this.layout()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user