Skip to content

Commit

Permalink
feat: persist custom popout group urls
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed Nov 15, 2024
1 parent 24cc974 commit be6c933
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/dockview-core/src/dockview/dockviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface SerializedFloatingGroup {

export interface SerializedPopoutGroup {
data: GroupPanelViewState;
url?: string;
gridReferenceGroup?: string;
position: Box | null;
}
Expand Down Expand Up @@ -709,6 +710,7 @@ export class DockviewComponent
group.model.location = {
type: 'popout',
getWindow: () => _window.window!,
popoutUrl: this.options.popoutUrl,
};

if (
Expand Down Expand Up @@ -1198,6 +1200,10 @@ export class DockviewComponent
data: group.popoutGroup.toJSON() as GroupPanelViewState,
gridReferenceGroup: group.referenceGroup,
position: group.window.dimensions(),
url:
group.popoutGroup.api.location.type === 'popout'
? group.popoutGroup.api.location.popoutUrl
: undefined,
};
}
);
Expand Down Expand Up @@ -1321,7 +1327,7 @@ export class DockviewComponent
const serializedPopoutGroups = data.popoutGroups ?? [];

for (const serializedPopoutGroup of serializedPopoutGroups) {
const { data, position, gridReferenceGroup } =
const { data, position, gridReferenceGroup, url } =
serializedPopoutGroup;

const group = createGroupFromSerializedState(data);
Expand All @@ -1335,6 +1341,7 @@ export class DockviewComponent
overridePopoutGroup: gridReferenceGroup
? group
: undefined,
popoutUrl: url,
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export interface IDockviewGroupPanelModel extends IPanel {
export type DockviewGroupLocation =
| { type: 'grid' }
| { type: 'floating' }
| { type: 'popout'; getWindow: () => Window };
| { type: 'popout'; getWindow: () => Window; popoutUrl?: string };

export class WillShowOverlayLocationEvent implements IDockviewEvent {
get kind(): DockviewGroupDropLocation {
Expand Down

0 comments on commit be6c933

Please sign in to comment.