Revert "prevent dropping a tab on itself - fixes #5580"

This reverts commit ceb1b59409.
This commit is contained in:
Eugene Pankov 2022-02-09 19:20:45 +01:00
parent 6e9f497d22
commit c0988e58b4
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
2 changed files with 2 additions and 17 deletions

View file

@ -158,7 +158,6 @@ export type SplitDropZoneInfo = {
></split-tab-spanner>
<split-tab-drop-zone
*ngFor='let dropZone of _dropZones'
[enabled]='dropZonesEnabled'
[parent]='this'
[dropZone]='dropZone'
(tabDropped)='onTabDropped($event, dropZone)'
@ -604,10 +603,6 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
this.tabAdopted.next(tab)
}
get dropZonesEnabled (): boolean {
return this.getAllTabs().length > 1
}
destroy (): void {
super.destroy()
for (const x of this.getAllTabs()) {

View file

@ -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<BaseTabComponent>()
@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()
}