Merge pull request #497 from mathuo/479-is-there-any-way-to-focus-the-panel-content

feat: events
This commit is contained in:
mathuo 2024-02-08 21:35:30 +00:00 committed by GitHub
commit 30c7fa2c6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 12 deletions

View File

@ -61,6 +61,7 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
options.group ??
this.accessor.addGroup({
direction: positionToDirection(options.position ?? 'right'),
skipSetActive: true,
});
this.accessor.moveGroupOrPanel({

View File

@ -795,15 +795,17 @@ export class DockviewComponent
skipPopoutAssociated: true,
});
} else {
const removedGroup = this.doRemoveGroup(group, {
skipDispose: true,
skipActive: true,
});
removedGroup.model.renderContainer =
this.overlayRenderContainer;
removedGroup.model.location = { type: 'grid' };
this.doAddGroup(removedGroup, [0]);
this.doSetGroupAndPanelActive(removedGroup);
if (this.getPanel(group.id)) {
const removedGroup = this.doRemoveGroup(group, {
skipDispose: true,
skipActive: true,
});
removedGroup.model.renderContainer =
this.overlayRenderContainer;
removedGroup.model.location = { type: 'grid' };
this.doAddGroup(removedGroup, [0]);
this.doSetGroupAndPanelActive(removedGroup);
}
}
})
);
@ -1594,7 +1596,9 @@ export class DockviewComponent
const group = this.orthogonalize(
directionToPosition(<Direction>options.direction)
);
this.doSetGroupAndPanelActive(group);
if (!options.skipSetActive) {
this.doSetGroupAndPanelActive(group);
}
return group;
}
@ -1607,7 +1611,9 @@ export class DockviewComponent
target
);
this.doAddGroup(group, relativeLocation);
this.doSetGroupAndPanelActive(group);
if (!options.skipSetActive) {
this.doSetGroupAndPanelActive(group);
}
return group;
} else {
this.doAddGroup(group);
@ -1922,11 +1928,13 @@ export class DockviewComponent
for (const panel of panels) {
to.model.openPanel(panel, {
skipSetActive: panel !== activePanel,
skipSetGroupActive: panel !== activePanel,
skipSetGroupActive: true,
});
}
});
this.doSetGroupAndPanelActive(to);
panels.forEach((panel) => {
this._onDidMovePanel.fire({ panel });
});

View File

@ -38,6 +38,7 @@ interface GroupMoveEvent {
interface CoreGroupOptions {
locked?: DockviewGroupPanelLocked;
hideHeader?: boolean;
skipSetActive?: boolean;
}
export interface GroupOptions extends CoreGroupOptions {