forked from KNXCloud/lowcode-engine-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.ts
More file actions
27 lines (22 loc) · 857 Bytes
/
init.ts
File metadata and controls
27 lines (22 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { injectAssets } from '@alilc/lowcode-plugin-inject';
import { ILowCodePluginContext } from '@alilc/lowcode-engine';
import { getProjectSchemaToLocalStorage } from '@/utils/store';
import assets from '@/assets/assets.json';
import originSchema from '@/assets/schema.json';
const editorInit = (ctx: ILowCodePluginContext) => {
return {
name: 'editor-init',
async init() {
const { material, project } = ctx;
const loadedAssets = await injectAssets(assets);
material.setAssets(loadedAssets);
const projectSchema = getProjectSchemaToLocalStorage();
const schema = projectSchema ? projectSchema['componentsTree'].pop() : originSchema;
project.onSimulatorRendererReady(() => {
project.openDocument(schema);
});
},
};
};
editorInit.pluginName = 'editorInit';
export default editorInit;