Skip to content

Commit

Permalink
fix: fix workspace openEditorWindow API bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Sep 26, 2023
1 parent 4728484 commit b161091
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/workspace/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ export class Workspace implements IWorkspace {
}

const windowInfo = this.windowQueue.shift();
if (windowInfo) {
if (windowInfo instanceof Resource) {
this.openEditorWindowByResource(windowInfo);
} else if (windowInfo) {
this.openEditorWindow(windowInfo.name, windowInfo.title, windowInfo.options, windowInfo.viewName);
}
}
Expand Down Expand Up @@ -251,7 +253,7 @@ export class Workspace implements IWorkspace {
}

async openEditorWindowByResource(resource: IResource, sleep: boolean = false): Promise<void> {
if (this.window && !this.window?.initReady && !sleep) {
if (this.window && !this.window.sleep && !this.window?.initReady && !sleep) {
this.windowQueue.push(resource);
return;
}
Expand Down Expand Up @@ -292,7 +294,7 @@ export class Workspace implements IWorkspace {
}

async openEditorWindow(name: string, title: string, options: Object, viewName?: string, sleep?: boolean) {
if (this.window && !this.window?.initReady && !sleep) {
if (this.window && !this.window.sleep && !this.window?.initReady && !sleep) {
this.windowQueue.push({
name, title, options, viewName,
});
Expand All @@ -304,7 +306,7 @@ export class Workspace implements IWorkspace {
return;
}
this.window?.updateState(WINDOW_STATE.inactive);
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title));
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title) || (d.resource.id == title));
if (filterWindows && filterWindows.length) {
this.window = filterWindows[0];
if (!sleep && this.window.sleep) {
Expand All @@ -320,6 +322,7 @@ export class Workspace implements IWorkspace {
resourceName: name,
title,
options,
id: title?.toString(),
}, resourceType, this);
const window = new EditorWindow(resource, this, {
title,
Expand Down

0 comments on commit b161091

Please sign in to comment.