mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
feat: improve the workspace sleep scene
This commit is contained in:
parent
2b3d96ceda
commit
059ffe0eaa
@ -51,9 +51,6 @@ export class EditorWindow implements IEditorWindow {
|
||||
this.title = config.title;
|
||||
this.icon = resource.icon;
|
||||
this.sleep = config.sleep;
|
||||
if (!config.sleep) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
async importSchema(schema: any) {
|
||||
@ -155,6 +152,8 @@ export class EditorWindow implements IEditorWindow {
|
||||
return;
|
||||
}
|
||||
|
||||
this.editorView.setActivate(true);
|
||||
|
||||
if (!ignoreEmit) {
|
||||
this.emitter.emit('window.change.view.type', name);
|
||||
|
||||
@ -162,7 +161,6 @@ export class EditorWindow implements IEditorWindow {
|
||||
this.workspace.emitChangeActiveEditorView();
|
||||
}
|
||||
}
|
||||
this.editorView.setActivate(true);
|
||||
};
|
||||
|
||||
get project() {
|
||||
|
||||
@ -115,7 +115,7 @@ export class Workspace implements IWorkspace {
|
||||
}
|
||||
}
|
||||
|
||||
initWindow() {
|
||||
async initWindow() {
|
||||
if (!this.defaultResourceType || this.enableAutoOpenFirstWindow === false) {
|
||||
return;
|
||||
}
|
||||
@ -127,6 +127,7 @@ export class Workspace implements IWorkspace {
|
||||
this.window = new EditorWindow(resource, this, {
|
||||
title: resource.title,
|
||||
});
|
||||
await this.window.init();
|
||||
this.editorWindowMap.set(this.window.id, this.window);
|
||||
this.windows = [...this.windows, this.window];
|
||||
this.emitChangeWindow();
|
||||
@ -196,6 +197,9 @@ export class Workspace implements IWorkspace {
|
||||
this.windows.splice(index, 1);
|
||||
if (this.window === window) {
|
||||
this.window = this.windows[index] || this.windows[index + 1] || this.windows[index - 1];
|
||||
if (this.window.sleep) {
|
||||
this.window.init();
|
||||
}
|
||||
this.emitChangeActiveWindow();
|
||||
}
|
||||
this.emitChangeWindow();
|
||||
@ -206,10 +210,13 @@ export class Workspace implements IWorkspace {
|
||||
this.remove(index);
|
||||
}
|
||||
|
||||
openEditorWindowById(id: string) {
|
||||
async openEditorWindowById(id: string) {
|
||||
const window = this.editorWindowMap.get(id);
|
||||
if (window) {
|
||||
this.window = window;
|
||||
if (window.sleep) {
|
||||
await window.init();
|
||||
}
|
||||
this.emitChangeActiveWindow();
|
||||
}
|
||||
}
|
||||
@ -252,6 +259,7 @@ export class Workspace implements IWorkspace {
|
||||
this.editorWindowMap.set(window.id, window);
|
||||
if (!sleep) {
|
||||
this.window = window;
|
||||
await this.window.init();
|
||||
}
|
||||
this.emitChangeWindow();
|
||||
this.emitChangeActiveWindow();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user