提交 d0274c04 编写于 作者: B Benjamin Pasero

grid - fix removeGroup() to never keep active group undefined

上级 39e9f699
......@@ -205,27 +205,23 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
return;
}
const hasFocus = isAncestor(document.activeElement, groupView.element);
// Remove from grid widget & dispose
this.gridWidget.removeView(groupView);
groupView.dispose();
// Remove as active group if it was
if (this._activeGroup === groupView) {
this._activeGroup = void 0;
}
const groupHasFocus = isAncestor(document.activeElement, groupView.element);
// Activate next group if the removed one was active
if (!this._activeGroup) {
const nextActiveGroup = this.asGroupView(this.mostRecentActiveGroups[0]);
if (this._activeGroup === groupView) {
const mostRecentlyActiveGroups = this.getGroups(true);
const nextActiveGroup = mostRecentlyActiveGroups[1]; // [0] will be the current group we are about to dispose
this.activateGroup(nextActiveGroup);
// Restore focus if we had it previously
if (hasFocus) {
if (groupHasFocus) {
nextActiveGroup.focus();
}
}
// Remove from grid widget & dispose
this.gridWidget.removeView(groupView);
groupView.dispose();
}
private toGridViewDirection(direction: Direction): GridViewDirection {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册