mirror of
https://github.com/mathuo/dockview
synced 2025-01-22 09:25:57 +00:00
feat: popout persistance logic
This commit is contained in:
parent
c4f46a190a
commit
9e57a8691a
@ -110,7 +110,7 @@ export interface SerializedFloatingGroup {
|
|||||||
|
|
||||||
export interface SerializedPopoutGroup {
|
export interface SerializedPopoutGroup {
|
||||||
data: GroupPanelViewState;
|
data: GroupPanelViewState;
|
||||||
gridReferenceGroup: string;
|
gridReferenceGroup?: string;
|
||||||
position: Box | null;
|
position: Box | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ export class DockviewComponent
|
|||||||
private readonly _popoutGroups: {
|
private readonly _popoutGroups: {
|
||||||
window: PopoutWindow;
|
window: PopoutWindow;
|
||||||
popoutGroup: DockviewGroupPanel;
|
popoutGroup: DockviewGroupPanel;
|
||||||
referenceGroup: DockviewGroupPanel;
|
referenceGroup: string;
|
||||||
disposable: IDisposable;
|
disposable: IDisposable;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
private readonly _rootDropTarget: Droptarget;
|
private readonly _rootDropTarget: Droptarget;
|
||||||
@ -676,7 +676,7 @@ export class DockviewComponent
|
|||||||
const value = {
|
const value = {
|
||||||
window: _window,
|
window: _window,
|
||||||
popoutGroup: group,
|
popoutGroup: group,
|
||||||
referenceGroup,
|
referenceGroup: referenceGroup.id,
|
||||||
disposable: popoutWindowDisposable,
|
disposable: popoutWindowDisposable,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ export class DockviewComponent
|
|||||||
(group) => {
|
(group) => {
|
||||||
return {
|
return {
|
||||||
data: group.popoutGroup.toJSON() as GroupPanelViewState,
|
data: group.popoutGroup.toJSON() as GroupPanelViewState,
|
||||||
gridReferenceGroup: group.referenceGroup.id,
|
gridReferenceGroup: group.referenceGroup,
|
||||||
position: group.window.dimensions(),
|
position: group.window.dimensions(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1159,19 +1159,16 @@ export class DockviewComponent
|
|||||||
|
|
||||||
const group = createGroupFromSerializedState(data);
|
const group = createGroupFromSerializedState(data);
|
||||||
|
|
||||||
if (!gridReferenceGroup) {
|
|
||||||
/**
|
|
||||||
* workaround to handle <= v1.9.2
|
|
||||||
*/
|
|
||||||
this.doAddGroup(group, [0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addPopoutGroup(
|
this.addPopoutGroup(
|
||||||
this.getPanel(gridReferenceGroup) ?? group,
|
(gridReferenceGroup
|
||||||
|
? this.getPanel(gridReferenceGroup)
|
||||||
|
: undefined) ?? group,
|
||||||
{
|
{
|
||||||
skipRemoveGroup: true,
|
skipRemoveGroup: true,
|
||||||
position: position ?? undefined,
|
position: position ?? undefined,
|
||||||
overridePopoutGroup: group,
|
overridePopoutGroup: gridReferenceGroup
|
||||||
|
? group
|
||||||
|
: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1581,8 +1578,11 @@ export class DockviewComponent
|
|||||||
if (selectedGroup) {
|
if (selectedGroup) {
|
||||||
if (!options?.skipDispose) {
|
if (!options?.skipDispose) {
|
||||||
if (!options?.skipPopoutAssociated) {
|
if (!options?.skipPopoutAssociated) {
|
||||||
if (this._groups.has(selectedGroup.referenceGroup.id)) {
|
const refGroup = this.getPanel(
|
||||||
this.removeGroup(selectedGroup.referenceGroup);
|
selectedGroup.referenceGroup
|
||||||
|
);
|
||||||
|
if (refGroup) {
|
||||||
|
this.removeGroup(refGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user