mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 17:07:15 +00:00
Revert "prevent dropping a tab on itself - fixes #5580"
This reverts commit ceb1b59409
.
This commit is contained in:
parent
6e9f497d22
commit
c0988e58b4
2 changed files with 2 additions and 17 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue