From c0988e58b4506d9ba41a3b35c1cdbfaef75fd8d1 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Wed, 9 Feb 2022 19:20:45 +0100 Subject: [PATCH] Revert "prevent dropping a tab on itself - fixes #5580" This reverts commit ceb1b59409eefca423140ef17f25ac83beee3496. --- tabby-core/src/components/splitTab.component.ts | 5 ----- .../src/components/splitTabDropZone.component.ts | 14 ++------------ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index 28bfe0e1..d3b3350f 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -158,7 +158,6 @@ 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 a62bc304..138825e9 100644 --- a/tabby-core/src/components/splitTabDropZone.component.ts +++ b/tabby-core/src/components/splitTabDropZone.component.ts @@ -23,32 +23,22 @@ 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 && this.canActivateFor(tab)) + this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container.children[this.dropZone.position]) 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() }