forked from alibaba/lowcode-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
49 lines (45 loc) · 1.19 KB
/
index.tsx
File metadata and controls
49 lines (45 loc) · 1.19 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { CodeEditorPane } from './pane';
import { project } from '@alilc/lowcode-engine';
import icon from './icon';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
const plugin = (ctx: IPublicModelPluginContext) => {
return {
name: 'codeEditor',
width: 600,
// 依赖的插件(插件名数组)
dep: [],
// 插件对外暴露的数据和方法
exports() {
return {};
},
// 插件的初始化函数,在引擎初始化之后会立刻调用
init() {
const codeEditorDock = ctx.skeleton.add({
area: 'leftArea',
name: 'codeEditor',
type: 'PanelDock',
props: {
icon,
description: '源码面板',
},
panelProps: {
width: '600px',
title: '源码面板',
},
content: (
<CodeEditorPane
event={ctx.event}
skeleton={ctx.skeleton}
project={ctx.project}
/>
),
});
codeEditorDock && codeEditorDock.disable();
project.onSimulatorRendererReady(() => {
codeEditorDock.enable();
});
},
};
};
plugin.pluginName = 'codeEditor';
export default plugin;