mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-12 02:46:08 +00:00
fix: 修复 workspace mode 下报错的问题
This commit is contained in:
parent
cbbe6d3152
commit
6d2a77a766
@ -37,7 +37,7 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
|||||||
this.contextApiAssembler = contextApiAssembler;
|
this.contextApiAssembler = contextApiAssembler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getLowCodePluginContext(options: IPluginContextOptions) {
|
_getLowCodePluginContext(options: IPluginContextOptions) {
|
||||||
return new LowCodePluginContext(this, options, this.contextApiAssembler);
|
return new LowCodePluginContext(this, options, this.contextApiAssembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { Editor, engineConfig, Setters as InnerSetters } from '@alilc/lowcode-editor-core';
|
import { Editor, engineConfig, Setters as InnerSetters } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
Designer,
|
Designer,
|
||||||
|
ILowCodePluginContextApiAssembler,
|
||||||
LowCodePluginManager,
|
LowCodePluginManager,
|
||||||
TransformStage,
|
ILowCodePluginContextPrivate,
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import {
|
import {
|
||||||
Skeleton as InnerSkeleton,
|
Skeleton as InnerSkeleton,
|
||||||
@ -12,12 +13,13 @@ import {
|
|||||||
WorkSpace,
|
WorkSpace,
|
||||||
} from '@alilc/lowcode-workspace';
|
} from '@alilc/lowcode-workspace';
|
||||||
|
|
||||||
import { Hotkey, Project, Skeleton, Setters, Material, Event } from '@alilc/lowcode-shell';
|
import { Hotkey, Project, Skeleton, Setters, Material, Event, Common } from '@alilc/lowcode-shell';
|
||||||
import { getLogger } from '@alilc/lowcode-utils';
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
import { setterRegistry } from 'engine/src/inner-plugins/setter-registry';
|
import { setterRegistry } from 'engine/src/inner-plugins/setter-registry';
|
||||||
import { componentMetaParser } from 'engine/src/inner-plugins/component-meta-parser';
|
import { componentMetaParser } from 'engine/src/inner-plugins/component-meta-parser';
|
||||||
import defaultPanelRegistry from 'engine/src/inner-plugins/default-panel-registry';
|
import defaultPanelRegistry from 'engine/src/inner-plugins/default-panel-registry';
|
||||||
import { EditorWindow } from './editor-window/context';
|
import { EditorWindow } from './editor-window/context';
|
||||||
|
import { shellModelFactory } from './shell-model-factory';
|
||||||
|
|
||||||
export class BasicContext {
|
export class BasicContext {
|
||||||
skeleton;
|
skeleton;
|
||||||
@ -53,12 +55,10 @@ export class BasicContext {
|
|||||||
const designer: Designer = new Designer({
|
const designer: Designer = new Designer({
|
||||||
editor,
|
editor,
|
||||||
name,
|
name,
|
||||||
|
shellModelFactory,
|
||||||
});
|
});
|
||||||
editor.set('designer' as any, designer);
|
editor.set('designer' as any, designer);
|
||||||
|
|
||||||
const plugins = new LowCodePluginManager(editor).toProxy();
|
|
||||||
editor.set('plugins' as any, plugins);
|
|
||||||
|
|
||||||
const { project: innerProject } = designer;
|
const { project: innerProject } = designer;
|
||||||
const hotkey = new Hotkey(name);
|
const hotkey = new Hotkey(name);
|
||||||
const innerSetters = new InnerSetters(name);
|
const innerSetters = new InnerSetters(name);
|
||||||
@ -75,7 +75,6 @@ export class BasicContext {
|
|||||||
this.innerSetters = innerSetters;
|
this.innerSetters = innerSetters;
|
||||||
this.innerSkeleton = innerSkeleton;
|
this.innerSkeleton = innerSkeleton;
|
||||||
this.skeleton = skeleton;
|
this.skeleton = skeleton;
|
||||||
this.plugins = plugins;
|
|
||||||
this.innerProject = innerProject;
|
this.innerProject = innerProject;
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.setters = setters;
|
this.setters = setters;
|
||||||
@ -86,6 +85,24 @@ export class BasicContext {
|
|||||||
this.hotkey = hotkey;
|
this.hotkey = hotkey;
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.designer = designer;
|
this.designer = designer;
|
||||||
|
const common = new Common(editor, innerSkeleton);
|
||||||
|
|
||||||
|
const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
||||||
|
assembleApis: (context: ILowCodePluginContextPrivate) => {
|
||||||
|
context.hotkey = hotkey;
|
||||||
|
context.project = project;
|
||||||
|
context.skeleton = skeleton;
|
||||||
|
context.setters = setters;
|
||||||
|
context.material = material;
|
||||||
|
context.event = event;
|
||||||
|
context.config = config;
|
||||||
|
context.common = common;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const plugins = new LowCodePluginManager(pluginContextApiAssembler).toProxy();
|
||||||
|
editor.set('plugins' as any, plugins);
|
||||||
|
this.plugins = plugins;
|
||||||
|
|
||||||
// 注册一批内置插件
|
// 注册一批内置插件
|
||||||
this.registerInnerPlugins = async function registerPlugins() {
|
this.registerInnerPlugins = async function registerPlugins() {
|
||||||
|
|||||||
18
packages/workspace/src/shell-model-factory.ts
Normal file
18
packages/workspace/src/shell-model-factory.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import {
|
||||||
|
Node as InnerNode,
|
||||||
|
SettingField as InnerSettingField,
|
||||||
|
} from '@alilc/lowcode-designer';
|
||||||
|
import { IShellModelFactory, IPublicModelNode, IPublicModelSettingPropEntry } from '@alilc/lowcode-types';
|
||||||
|
import {
|
||||||
|
Node,
|
||||||
|
SettingPropEntry,
|
||||||
|
} from '@alilc/lowcode-shell';
|
||||||
|
class ShellModelFactory implements IShellModelFactory {
|
||||||
|
createNode(node: InnerNode | null | undefined): IPublicModelNode | null {
|
||||||
|
return Node.create(node);
|
||||||
|
}
|
||||||
|
createSettingPropEntry(prop: InnerSettingField): IPublicModelSettingPropEntry {
|
||||||
|
return SettingPropEntry.create(prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const shellModelFactory = new ShellModelFactory();
|
||||||
Loading…
x
Reference in New Issue
Block a user