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
24 lines (20 loc) · 799 Bytes
/
Copy pathinit.ts
File metadata and controls
24 lines (20 loc) · 799 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
import { injectAssets } from '@alilc/lowcode-plugin-inject';
import { ILowCodePluginContext } from '@alilc/lowcode-engine';
import assets from '../assets/assets.json';
import originSchema from '../assets/schema.json';
import { getProjectSchemaToLocalStorage } from '@/utils/store';
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.openDocument(schema);
},
};
};
editorInit.pluginName = 'editorInit';
export default editorInit;