mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-01 05:30:40 +00:00
refactor: 提前处理 set assets, 增加 set assets 和 project.load 执行的鲁棒性
This commit is contained in:
parent
e309f4deaf
commit
bac6e637ca
@ -459,7 +459,7 @@ export class Designer {
|
||||
|
||||
private _lostComponentMetasMap = new Map<string, ComponentMeta>();
|
||||
|
||||
private buildComponentMetasMap(metas: ComponentMetadata[]) {
|
||||
buildComponentMetasMap(metas: ComponentMetadata[]) {
|
||||
metas.forEach((data) => this.createComponentMeta(data));
|
||||
}
|
||||
|
||||
|
||||
@ -103,6 +103,19 @@ const getSelection = () => designer.currentDocument?.selection;
|
||||
engineConfig,
|
||||
};
|
||||
|
||||
// 处理 editor.set('assets'),将组件元数据创建好
|
||||
plugins.register((ctx: ILowCodePluginContext) => {
|
||||
return {
|
||||
name: '___component_meta_parser___',
|
||||
init() {
|
||||
editor.onGot('assets', (assets: any) => {
|
||||
const { components = [] } = assets;
|
||||
designer.buildComponentMetasMap(components);
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// 注册默认的 setters
|
||||
plugins.register((ctx: ILowCodePluginContext) => {
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user