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