mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 17:57:13 +00:00
fix: init
This commit is contained in:
parent
d3f8a96e72
commit
bf0ffc55fb
@ -59,7 +59,7 @@ export class Skeleton {
|
|||||||
|
|
||||||
readonly stages: Area<StageConfig, Stage>;
|
readonly stages: Area<StageConfig, Stage>;
|
||||||
|
|
||||||
constructor(readonly editor: Editor) {
|
constructor(readonly editor: Editor, readonly name: string = 'unknown') {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
this.leftArea = new Area(
|
this.leftArea = new Area(
|
||||||
this,
|
this,
|
||||||
|
|||||||
@ -20,7 +20,6 @@ export class EditorView extends Component<any, any> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const innerSkeleton = this.ctx.skeleton[skeletonSymbol];
|
const innerSkeleton = this.ctx.skeleton[skeletonSymbol];
|
||||||
// debugger;
|
|
||||||
return (
|
return (
|
||||||
<Workbench
|
<Workbench
|
||||||
skeleton={innerSkeleton}
|
skeleton={innerSkeleton}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { globalContext } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
Skeleton as InnerSkeleton,
|
Skeleton as InnerSkeleton,
|
||||||
IWidgetBaseConfig,
|
IWidgetBaseConfig,
|
||||||
@ -6,11 +7,25 @@ import {
|
|||||||
} from '@alilc/lowcode-editor-skeleton';
|
} from '@alilc/lowcode-editor-skeleton';
|
||||||
import { skeletonSymbol } from './symbols';
|
import { skeletonSymbol } from './symbols';
|
||||||
|
|
||||||
export default class Skeleton {
|
const innerSkeletonSymbol = Symbol('skeleton');
|
||||||
private readonly [skeletonSymbol]: InnerSkeleton;
|
|
||||||
|
|
||||||
constructor(skeleton: InnerSkeleton) {
|
export default class Skeleton {
|
||||||
this[skeletonSymbol] = skeleton;
|
private readonly [innerSkeletonSymbol]: InnerSkeleton;
|
||||||
|
|
||||||
|
get [skeletonSymbol]() {
|
||||||
|
if (this.workspaceMode) {
|
||||||
|
return this[innerSkeletonSymbol];
|
||||||
|
}
|
||||||
|
const workSpace = globalContext.get('workSpace');
|
||||||
|
if (workSpace.isActive) {
|
||||||
|
return workSpace.window.innerSkeleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this[innerSkeletonSymbol];
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(skeleton: InnerSkeleton, readonly workspaceMode: boolean = false) {
|
||||||
|
this[innerSkeletonSymbol] = skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -34,6 +34,7 @@ export class BasicContext {
|
|||||||
designer;
|
designer;
|
||||||
registerInnerPlugins: any;
|
registerInnerPlugins: any;
|
||||||
innerSetters: any;
|
innerSetters: any;
|
||||||
|
innerSkeleton: any;
|
||||||
|
|
||||||
constructor(workSpace: WorkSpace, name: string, public editorWindow?: EditorWindow) {
|
constructor(workSpace: WorkSpace, name: string, public editorWindow?: EditorWindow) {
|
||||||
const editor = new Editor(name, true);
|
const editor = new Editor(name, true);
|
||||||
@ -46,7 +47,7 @@ export class BasicContext {
|
|||||||
// if (editorWindow) {
|
// if (editorWindow) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const innerSkeleton = new InnerSkeleton(editor);
|
const innerSkeleton = new InnerSkeleton(editor, name);
|
||||||
editor.set('skeleton' as any, innerSkeleton);
|
editor.set('skeleton' as any, innerSkeleton);
|
||||||
|
|
||||||
const designer: Designer = new Designer({
|
const designer: Designer = new Designer({
|
||||||
@ -62,16 +63,18 @@ export class BasicContext {
|
|||||||
const hotkey = new Hotkey(name);
|
const hotkey = new Hotkey(name);
|
||||||
const innerSetters = new InnerSetters(name);
|
const innerSetters = new InnerSetters(name);
|
||||||
const setters = new Setters(innerSetters, true);
|
const setters = new Setters(innerSetters, true);
|
||||||
const material = new Material(editor, true);
|
const material = new Material(editor, true, name);
|
||||||
const project = new Project(innerProject, true);
|
const project = new Project(innerProject, true);
|
||||||
const config = engineConfig;
|
const config = engineConfig;
|
||||||
const event = new Event(editor, { prefix: 'common' });
|
const event = new Event(editor, { prefix: 'common' });
|
||||||
const logger = getLogger({ level: 'warn', bizName: 'common' });
|
const logger = getLogger({ level: 'warn', bizName: 'common' });
|
||||||
|
const skeleton = new Skeleton(innerSkeleton, true);
|
||||||
editor.set('setters', setters);
|
editor.set('setters', setters);
|
||||||
editor.set('project', project);
|
editor.set('project', project);
|
||||||
editor.set('material', material);
|
editor.set('material', material);
|
||||||
this.innerSetters = innerSetters;
|
this.innerSetters = innerSetters;
|
||||||
this.skeleton = innerSkeleton;
|
this.innerSkeleton = innerSkeleton;
|
||||||
|
this.skeleton = skeleton;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
this.innerProject = innerProject;
|
this.innerProject = innerProject;
|
||||||
this.project = project;
|
this.project = project;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export class EditorView extends Component<any, any> {
|
|||||||
render() {
|
render() {
|
||||||
const { active } = this.props;
|
const { active } = this.props;
|
||||||
const editorView = this.props.editorView;
|
const editorView = this.props.editorView;
|
||||||
const skeleton = editorView.skeleton;
|
const skeleton = editorView.innerSkeleton;
|
||||||
if (!editorView.isInit) {
|
if (!editorView.isInit) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ export class EditorWindow {
|
|||||||
|
|
||||||
initViewTypes = async () => {
|
initViewTypes = async () => {
|
||||||
const editorViews = this.resource.editorViews;
|
const editorViews = this.resource.editorViews;
|
||||||
for (let i = 0; i < editorViews.length; i++) {
|
for (let i = editorViews.length - 1; i >= 0; i--) {
|
||||||
const name = editorViews[i].name;
|
const name = editorViews[i].name;
|
||||||
await this.initViewType(name);
|
await this.initViewType(name);
|
||||||
if (!this.editorView) {
|
if (!this.editorView) {
|
||||||
@ -28,7 +28,7 @@ export class EditorWindow {
|
|||||||
|
|
||||||
execViewTypesInit = async () => {
|
execViewTypesInit = async () => {
|
||||||
const editorViews = this.resource.editorViews;
|
const editorViews = this.resource.editorViews;
|
||||||
for (let i = 0; i < editorViews.length; i++) {
|
for (let i = editorViews.length - 1; i >= 0; i--) {
|
||||||
const name = editorViews[i].name;
|
const name = editorViews[i].name;
|
||||||
this.changeViewType(name);
|
this.changeViewType(name);
|
||||||
await this.editorViews.get(name)?.init();
|
await this.editorViews.get(name)?.init();
|
||||||
@ -68,6 +68,10 @@ export class EditorWindow {
|
|||||||
return this.editorView?.innerProject;
|
return this.editorView?.innerProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get innerSkeleton() {
|
||||||
|
return this.editorView?.innerSkeleton;
|
||||||
|
}
|
||||||
|
|
||||||
get innerSetters() {
|
get innerSetters() {
|
||||||
return this.editorView?.innerSetters;
|
return this.editorView?.innerSetters;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user