joint source editor

This commit is contained in:
kangwei 2020-04-22 17:45:55 +08:00
parent 79827dc8b9
commit 8b02b10e4e
3 changed files with 48 additions and 50 deletions

View File

@ -57,7 +57,7 @@ export default class SourceEditor extends Component<{
tabKey: TAB_KEY.JS_TAB, tabKey: TAB_KEY.JS_TAB,
}; };
componentWillMount() { async componentWillMount() {
const { editor } = this.props; const { editor } = this.props;
editor.on('leftPanel.show', (key: String) => { editor.on('leftPanel.show', (key: String) => {
if (key === 'sourceEditor' && !this.monocoEditer) { if (key === 'sourceEditor' && !this.monocoEditer) {
@ -79,9 +79,7 @@ export default class SourceEditor extends Component<{
this.openPluginPannel(); this.openPluginPannel();
}) })
const designer = await editor.onceGot(Designer);
editor.once('designer.mount', (designer: Designer) => {
// let schema = designer.project.getSchema(); // let schema = designer.project.getSchema();
// mock data // mock data
let schema = { let schema = {
@ -116,7 +114,6 @@ export default class SourceEditor extends Component<{
}; };
this.initCode(schema); this.initCode(schema);
});
} }
openPluginPannel = () => { openPluginPannel = () => {

View File

@ -3,7 +3,6 @@ import { createElement } from 'react';
import { Button } from '@alifd/next'; import { Button } from '@alifd/next';
import Engine, { Panes } from '@ali/visualengine'; import Engine, { Panes } from '@ali/visualengine';
import getTrunkPane from '@ali/ve-trunk-pane'; import getTrunkPane from '@ali/ve-trunk-pane';
import SourceEditor from '@ali/lowcode-plugin-source-editor';
import EventBindDialog from '@ali/lowcode-plugin-event-bind-dialog'; import EventBindDialog from '@ali/lowcode-plugin-event-bind-dialog';
import loadUrls from './loader'; import loadUrls from './loader';
import { upgradeAssetsBundle } from './upgrade-assets'; import { upgradeAssetsBundle } from './upgrade-assets';
@ -16,20 +15,6 @@ skeleton.add({
type: 'Widget', type: 'Widget',
content: EventBindDialog, content: EventBindDialog,
}); });
skeleton.add({
name: 'sourceEditor',
type: 'PanelDock',
props: {
align: 'top',
icon: 'code',
description: '组件库',
},
panelProps: {
width: 500
// area: 'leftFixedArea'
},
content: SourceEditor,
});
skeleton.add({ skeleton.add({
area: 'leftArea', area: 'leftArea',
name: 'icon1', name: 'icon1',

View File

@ -9,6 +9,7 @@ import { Skeleton } from './skeleton/skeleton';
import Preview from '@ali/lowcode-plugin-sample-preview'; import Preview from '@ali/lowcode-plugin-sample-preview';
import SourceEditor from '@ali/lowcode-plugin-source-editor';
registerSetters(); registerSetters();
@ -53,3 +54,18 @@ skeleton.add({
}, },
content: Preview, content: Preview,
}); });
skeleton.add({
name: 'sourceEditor',
type: 'PanelDock',
props: {
align: 'top',
icon: 'code',
description: '组件库',
},
panelProps: {
width: 500
// area: 'leftFixedArea'
},
content: SourceEditor,
});