feat(workspace): update removeEditorWindow api by liujuping · Pull Request #2399 · alibaba/lowcode-engine · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/docs/api/workspace.md
8 changes: 6 additions & 2 deletions packages/shell/src/api/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ export class Workspace implements IPublicApiWorkspace {
this[workspaceSymbol].openEditorWindowById(id);
}

removeEditorWindow(resourceName: string, id: string) {
this[workspaceSymbol].removeEditorWindow(resourceName, id);
removeEditorWindow() {
if (typeof arguments[0] === 'string') {
this[workspaceSymbol].removeEditorWindow(arguments[0], arguments[1]);
} else {
this[workspaceSymbol].removeEditorWindowByResource(arguments[0]?.[resourceSymbol]);
}
}

removeEditorWindowById(id: string) {
Expand Down
10 changes: 9 additions & 1 deletion packages/types/src/shell/api/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ export interface IPublicApiWorkspace<
/** 通过视图 id 打开窗口 */
openEditorWindowById(id: string): void;

/** 移除视图窗口 */
/**
* 移除视图窗口
* @deprecated
*/
removeEditorWindow(resourceName: string, id: string): void;

/**
* 移除视图窗口
*/
removeEditorWindow(resource: Resource): void;

/** 通过视图 id 移除窗口 */
removeEditorWindowById(id: string): void;

Expand Down
21 changes: 19 additions & 2 deletions packages/workspace/src/workspace.ts