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 ?? options.group ??
this.accessor.addGroup({ this.accessor.addGroup({
direction: positionToDirection(options.position ?? 'right'), direction: positionToDirection(options.position ?? 'right'),
skipSetActive: true,
}); });
this.accessor.moveGroupOrPanel({ this.accessor.moveGroupOrPanel({

View File

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

View File

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