mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 04:29:58 +02:00
Refactor ZenViewSplitter to reset tab state when removing a group
This commit is contained in:
parent
5c62458dcb
commit
f56b8c0e59
2 changed files with 9 additions and 8 deletions
|
@ -85,7 +85,10 @@ var gZenViewSplitter = new (class {
|
||||||
*/
|
*/
|
||||||
removeGroup(groupIndex) {
|
removeGroup(groupIndex) {
|
||||||
if (this.currentView === groupIndex) {
|
if (this.currentView === groupIndex) {
|
||||||
this.resetSplitView();
|
this.resetSplitView(false);
|
||||||
|
}
|
||||||
|
for (const tab of this._data[groupIndex].tabs) {
|
||||||
|
this.resetTabState(tab, true);
|
||||||
}
|
}
|
||||||
this._data.splice(groupIndex, 1);
|
this._data.splice(groupIndex, 1);
|
||||||
}
|
}
|
||||||
|
@ -93,9 +96,11 @@ var gZenViewSplitter = new (class {
|
||||||
/**
|
/**
|
||||||
* Resets the split view.
|
* Resets the split view.
|
||||||
*/
|
*/
|
||||||
resetSplitView() {
|
resetSplitView(resetTabState = true) {
|
||||||
for (const tab of this._data[this.currentView].tabs) {
|
if (resetTabState) {
|
||||||
this.resetTabState(tab, true);
|
for (const tab of this._data[this.currentView].tabs) {
|
||||||
|
this.resetTabState(tab, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.removeSplitters();
|
this.removeSplitters();
|
||||||
|
|
||||||
|
|
|
@ -579,10 +579,6 @@ var ZenWorkspaces = {
|
||||||
let firstTab = undefined;
|
let firstTab = undefined;
|
||||||
let workspaces = await this._workspaces();
|
let workspaces = await this._workspaces();
|
||||||
for (let workspace of workspaces.workspaces) {
|
for (let workspace of workspaces.workspaces) {
|
||||||
if (workspace.uuid === window.uuid && workspace.used) {
|
|
||||||
// If the workspace is already active, do nothing
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
workspace.used = workspace.uuid === window.uuid;
|
workspace.used = workspace.uuid === window.uuid;
|
||||||
}
|
}
|
||||||
await this.unsafeSaveWorkspaces(workspaces);
|
await this.unsafeSaveWorkspaces(workspaces);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue