mirror of
https://github.com/mathuo/dockview
synced 2025-01-23 01:45:58 +00:00
Merge branch '469-add-window-lifecycle-callbacks' of https://github.com/mathuo/dockview into 469-add-window-lifecycle-callbacks-1
This commit is contained in:
commit
a8472e8b71
@ -830,6 +830,8 @@ export class DockviewApi implements CommonApi<SerializedDockview> {
|
||||
options?: {
|
||||
position?: Box;
|
||||
popoutUrl?: string;
|
||||
onOpened?: (id: string, window: Window) => void;
|
||||
onClosing?: (id: string, window: Window) => void;
|
||||
}
|
||||
): void {
|
||||
this.component.addPopoutGroup(item, options);
|
||||
|
@ -287,6 +287,8 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
|
||||
options?: {
|
||||
position?: Box;
|
||||
popoutUrl?: string;
|
||||
onOpened?: (id: string, window: Window) => void;
|
||||
onClosing?: (id: string, window: Window) => void;
|
||||
}
|
||||
): void;
|
||||
}
|
||||
@ -514,6 +516,8 @@ export class DockviewComponent
|
||||
skipRemoveGroup?: boolean;
|
||||
position?: Box;
|
||||
popoutUrl?: string;
|
||||
onOpened?: (id: string, window: Window) => void;
|
||||
onClosing?: (id: string, window: Window) => void;
|
||||
}
|
||||
): void {
|
||||
let group: DockviewGroupPanel;
|
||||
@ -562,6 +566,8 @@ export class DockviewComponent
|
||||
width: box.width,
|
||||
height: box.height,
|
||||
},
|
||||
onOpened: options?.onOpened,
|
||||
onClosing: options?.onClosing
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -13,6 +13,8 @@ export class DockviewPopoutGroupPanel extends CompositeDisposable {
|
||||
className: string;
|
||||
popoutUrl: string;
|
||||
box: Box;
|
||||
onOpened?: (id: string, window: Window) => void;
|
||||
onClosing?: (id: string, window: Window) => void;
|
||||
}
|
||||
) {
|
||||
super();
|
||||
@ -23,6 +25,8 @@ export class DockviewPopoutGroupPanel extends CompositeDisposable {
|
||||
top: this.options.box.top,
|
||||
width: this.options.box.width,
|
||||
height: this.options.box.height,
|
||||
onOpened: this.options.onOpened,
|
||||
onClosing: this.options.onClosing,
|
||||
});
|
||||
|
||||
group.model.location = {
|
||||
|
@ -5,6 +5,8 @@ import { Box } from './types';
|
||||
|
||||
export type PopoutWindowOptions = {
|
||||
url: string;
|
||||
onOpened?: (id: string, window: Window) => void;
|
||||
onClosing?: (id: string, window: Window) => void;
|
||||
} & Box;
|
||||
|
||||
export class PopoutWindow extends CompositeDisposable {
|
||||
@ -51,6 +53,10 @@ export class PopoutWindow extends CompositeDisposable {
|
||||
if (this._window) {
|
||||
this._onWillClose.fire();
|
||||
|
||||
if (this.options.onClosing) {
|
||||
this.options.onClosing(this.target, this._window.value);
|
||||
}
|
||||
|
||||
this._window.disposable.dispose();
|
||||
this._window.value.close();
|
||||
this._window = null;
|
||||
@ -125,6 +131,10 @@ export class PopoutWindow extends CompositeDisposable {
|
||||
this.close();
|
||||
});
|
||||
});
|
||||
|
||||
if (this.options.onOpened) {
|
||||
this.options.onOpened(this.target, externalWindow);
|
||||
}
|
||||
}
|
||||
|
||||
private createPopoutWindowContainer(): HTMLElement {
|
||||
|
Loading…
Reference in New Issue
Block a user