diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index cf70d54c..2c34ac6b 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -158,6 +158,7 @@ export type SplitDropZoneInfo = { > 1 + } + destroy (): void { super.destroy() for (const x of this.getAllTabs()) { diff --git a/tabby-core/src/components/splitTabDropZone.component.ts b/tabby-core/src/components/splitTabDropZone.component.ts index 138825e9..a62bc304 100644 --- a/tabby-core/src/components/splitTabDropZone.component.ts +++ b/tabby-core/src/components/splitTabDropZone.component.ts @@ -23,22 +23,32 @@ import { SplitDropZoneInfo } from './splitTab.component' export class SplitTabDropZoneComponent extends SelfPositioningComponent { @Input() dropZone: SplitDropZoneInfo @Input() parent: BaseTabComponent + @Input() enabled = false @Output() tabDropped = new EventEmitter() @HostBinding('class.active') isActive = false @HostBinding('class.highlighted') isHighlighted = false - // eslint-disable-next-line @typescript-eslint/no-useless-constructor constructor ( element: ElementRef, app: AppService, ) { super(element) this.subscribeUntilDestroyed(app.tabDragActive$, tab => { - this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container.children[this.dropZone.position]) + this.isActive = !!(tab && this.canActivateFor(tab)) 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 () { this.layout() }