mirror of
https://github.com/mathuo/dockview
synced 2025-09-07 09:56:40 +00:00
Return popouts whn blocked by browser
This commit is contained in:
parent
477bf14767
commit
809b7665f5
@ -251,6 +251,9 @@ export class Tabs extends CompositeDisposable {
|
||||
delete(id: string): void {
|
||||
const index = this.indexOf(id);
|
||||
const tabToRemove = this._tabs.splice(index, 1)[0];
|
||||
if (!tabToRemove) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { value, disposable } = tabToRemove;
|
||||
|
||||
|
@ -718,27 +718,11 @@ export class DockviewComponent
|
||||
return false;
|
||||
}
|
||||
|
||||
if (popoutContainer === null) {
|
||||
popoutWindowDisposable.dispose();
|
||||
this._onDidBlockPopout.fire();
|
||||
return false;
|
||||
}
|
||||
|
||||
const gready = document.createElement('div');
|
||||
gready.className = 'dv-overlay-render-container';
|
||||
|
||||
const overlayRenderContainer = new OverlayRenderContainer(
|
||||
gready,
|
||||
this
|
||||
);
|
||||
|
||||
const referenceGroup =
|
||||
itemToPopout instanceof DockviewPanel
|
||||
? itemToPopout.group
|
||||
: itemToPopout;
|
||||
|
||||
const referenceLocation = itemToPopout.api.location.type;
|
||||
|
||||
/**
|
||||
* The group that is being added doesn't already exist within the DOM, the most likely occurrence
|
||||
* of this case is when being called from the `fromJSON(...)` method
|
||||
@ -757,6 +741,36 @@ export class DockviewComponent
|
||||
this._onDidAddGroup.fire(group);
|
||||
}
|
||||
|
||||
if (popoutContainer === null) {
|
||||
popoutWindowDisposable.dispose();
|
||||
this._onDidBlockPopout.fire();
|
||||
|
||||
// if the popout window was blocked, we need to move the group back to the reference group
|
||||
// and set it to visible
|
||||
this.movingLock(() =>
|
||||
moveGroupWithoutDestroying({
|
||||
from: group,
|
||||
to: referenceGroup,
|
||||
})
|
||||
);
|
||||
|
||||
if (!referenceGroup.api.isVisible) {
|
||||
referenceGroup.api.setVisible(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const gready = document.createElement('div');
|
||||
gready.className = 'dv-overlay-render-container';
|
||||
|
||||
const overlayRenderContainer = new OverlayRenderContainer(
|
||||
gready,
|
||||
this
|
||||
);
|
||||
|
||||
const referenceLocation = itemToPopout.api.location.type;
|
||||
|
||||
group.model.renderContainer = overlayRenderContainer;
|
||||
group.layout(
|
||||
_window.window!.innerWidth,
|
||||
|
Loading…
x
Reference in New Issue
Block a user