diff --git a/packages/dockview-core/src/api/component.api.ts b/packages/dockview-core/src/api/component.api.ts index 13d108811..34bade162 100644 --- a/packages/dockview-core/src/api/component.api.ts +++ b/packages/dockview-core/src/api/component.api.ts @@ -749,6 +749,10 @@ export class DockviewApi implements CommonApi { return this.component.onDidPopoutGroupPositionChange; } + get onDidBlockPopout(): Event { + return this.component.onDidBlockPopout; + } + /** * All panel objects. */ diff --git a/packages/dockview-core/src/dockview/dockviewComponent.ts b/packages/dockview-core/src/dockview/dockviewComponent.ts index 707d4f7e9..ff1284d07 100644 --- a/packages/dockview-core/src/dockview/dockviewComponent.ts +++ b/packages/dockview-core/src/dockview/dockviewComponent.ts @@ -226,6 +226,7 @@ export interface IDockviewComponent extends IBaseGrid { readonly onDidMaximizedGroupChange: Event; readonly onDidPopoutGroupSizeChange: Event; readonly onDidPopoutGroupPositionChange: Event; + readonly onDidBlockPopout: Event; readonly options: DockviewComponentOptions; updateOptions(options: DockviewOptions): void; moveGroupOrPanel(options: MoveGroupOrPanelOptions): void; @@ -319,6 +320,9 @@ export class DockviewComponent readonly onDidPopoutGroupPositionChange: Event = this._onDidPopoutGroupPositionChange.event; + private readonly _onDidBlockPopout = new Emitter(); + readonly onDidBlockPopout: Event = this._onDidBlockPopout.event; + private readonly _onDidLayoutFromJSON = new Emitter(); readonly onDidLayoutFromJSON: Event = this._onDidLayoutFromJSON.event; @@ -505,6 +509,7 @@ export class DockviewComponent this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, + this._onDidBlockPopout, this.onDidViewVisibilityChangeMicroTaskQueue(() => { this.updateWatermark(); }), @@ -715,6 +720,7 @@ export class DockviewComponent if (popoutContainer === null) { popoutWindowDisposable.dispose(); + this._onDidBlockPopout.fire(); return false; } @@ -734,7 +740,7 @@ export class DockviewComponent const referenceLocation = itemToPopout.api.location.type; /** - * The group that is being added doesn't already exist within the DOM, the most likely occurance + * 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 */ const isGroupAddedToDom =