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

This reverts commit ceb1b594.
上级 6e9f497d
......@@ -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()) {
......
......@@ -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()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册