Skip to content

Commit 5c13918

Browse files
liujupingJackLian
authored andcommitted
fix: fix workspace openEditorWindow API bugs
1 parent 4728484 commit 5c13918

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/workspace/src/workspace.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ export class Workspace implements IWorkspace {
130130
}
131131

132132
const windowInfo = this.windowQueue.shift();
133-
if (windowInfo) {
133+
if (windowInfo instanceof Resource) {
134+
this.openEditorWindowByResource(windowInfo);
135+
} else if (windowInfo) {
134136
this.openEditorWindow(windowInfo.name, windowInfo.title, windowInfo.options, windowInfo.viewName);
135137
}
136138
}
@@ -251,7 +253,7 @@ export class Workspace implements IWorkspace {
251253
}
252254

253255
async openEditorWindowByResource(resource: IResource, sleep: boolean = false): Promise<void> {
254-
if (this.window && !this.window?.initReady && !sleep) {
256+
if (this.window && !this.window.sleep && !this.window?.initReady && !sleep) {
255257
this.windowQueue.push(resource);
256258
return;
257259
}
@@ -292,7 +294,7 @@ export class Workspace implements IWorkspace {
292294
}
293295

294296
async openEditorWindow(name: string, title: string, options: Object, viewName?: string, sleep?: boolean) {
295-
if (this.window && !this.window?.initReady && !sleep) {
297+
if (this.window && !this.window.sleep && !this.window?.initReady && !sleep) {
296298
this.windowQueue.push({
297299
name, title, options, viewName,
298300
});
@@ -304,7 +306,7 @@ export class Workspace implements IWorkspace {
304306
return;
305307
}
306308
this.window?.updateState(WINDOW_STATE.inactive);
307-
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title));
309+
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title) || (d.resource.id == title));
308310
if (filterWindows && filterWindows.length) {
309311
this.window = filterWindows[0];
310312
if (!sleep && this.window.sleep) {
@@ -320,6 +322,7 @@ export class Workspace implements IWorkspace {
320322
resourceName: name,
321323
title,
322324
options,
325+
id: title?.toString(),
323326
}, resourceType, this);
324327
const window = new EditorWindow(resource, this, {
325328
title,

0 commit comments

Comments
 (0)