mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 05:48:17 +00:00
joint source panel
This commit is contained in:
parent
eb9a83f64d
commit
9f66f458e8
@ -3,6 +3,7 @@ import { Tab, Search, Input, Button } from '@alifd/next';
|
|||||||
import Editor from '@ali/lowcode-editor-core';
|
import Editor from '@ali/lowcode-editor-core';
|
||||||
import { js_beautify, css_beautify } from 'js-beautify';
|
import { js_beautify, css_beautify } from 'js-beautify';
|
||||||
import MonacoEditor from 'react-monaco-editor';
|
import MonacoEditor from 'react-monaco-editor';
|
||||||
|
import Panel from '../../vision-polyfill/src/skeleton/panel';
|
||||||
|
|
||||||
// import lolizer from './sorceEditorPlugin',
|
// import lolizer from './sorceEditorPlugin',
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ interface FunctionEventParam {
|
|||||||
|
|
||||||
export default class SourceEditor extends Component<{
|
export default class SourceEditor extends Component<{
|
||||||
editor: Editor;
|
editor: Editor;
|
||||||
|
panel?: Panel
|
||||||
}> {
|
}> {
|
||||||
private monocoEditer: Object;
|
private monocoEditer: Object;
|
||||||
private editorCmd: Object;
|
private editorCmd: Object;
|
||||||
@ -118,12 +120,15 @@ export default class SourceEditor extends Component<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
openPluginPannel = () => {
|
openPluginPannel = () => {
|
||||||
const {editor} = this.props;
|
const { editor, panel } = this.props;
|
||||||
// 判断面板是否处于激活状态
|
// 判断面板是否处于激活状态
|
||||||
if (!editor.leftNav || editor.leftNav != 'sourceEditor') {
|
if (!editor.leftNav || editor.leftNav != 'sourceEditor') {
|
||||||
// 打开面板
|
// 打开面板
|
||||||
editor.emit('leftNav.change', 'sourceEditor');
|
editor.emit('leftNav.change', 'sourceEditor');
|
||||||
}
|
}
|
||||||
|
if (panel) {
|
||||||
|
panel.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callEditorEvent = (eventName, params) => {
|
callEditorEvent = (eventName, params) => {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
|
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
||||||
|
|
||||||
module.exports = ({ onGetWebpackConfig }) => {
|
module.exports = ({ onGetWebpackConfig }) => {
|
||||||
onGetWebpackConfig((config) => {
|
onGetWebpackConfig((config) => {
|
||||||
@ -7,6 +8,14 @@ module.exports = ({ onGetWebpackConfig }) => {
|
|||||||
.use(TsconfigPathsPlugin, [{
|
.use(TsconfigPathsPlugin, [{
|
||||||
configFile: "./tsconfig.json"
|
configFile: "./tsconfig.json"
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
config
|
||||||
|
// 定义插件名称
|
||||||
|
.plugin('MonacoWebpackPlugin')
|
||||||
|
// 第一项为具体插件,第二项为插件参数
|
||||||
|
.use(new MonacoWebpackPlugin({
|
||||||
|
languages:["javascript","css","json"]
|
||||||
|
}), []);
|
||||||
config.plugins.delete('hot');
|
config.plugins.delete('hot');
|
||||||
config.devServer.hot(false);
|
config.devServer.hot(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
"build-plugin-fusion": "^0.1.0",
|
"build-plugin-fusion": "^0.1.0",
|
||||||
"build-plugin-moment-locales": "^0.1.0",
|
"build-plugin-moment-locales": "^0.1.0",
|
||||||
"build-plugin-react-app": "^1.1.2",
|
"build-plugin-react-app": "^1.1.2",
|
||||||
"tsconfig-paths-webpack-plugin": "^3.2.0"
|
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
||||||
|
"monaco-editor-webpack-plugin":"^1.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export default class Panel implements IWidget {
|
|||||||
return this._body;
|
return this._body;
|
||||||
}
|
}
|
||||||
|
|
||||||
get content() {
|
get content(): ReactNode {
|
||||||
if (this.plain) {
|
if (this.plain) {
|
||||||
return createElement(PanelView, {
|
return createElement(PanelView, {
|
||||||
panel: this,
|
panel: this,
|
||||||
|
|||||||
@ -195,24 +195,32 @@ export class Skeleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config = this.parseConfig(config);
|
config = this.parseConfig(config);
|
||||||
|
let widget: IWidget;
|
||||||
if (isDockConfig(config)) {
|
if (isDockConfig(config)) {
|
||||||
if (isPanelDockConfig(config)) {
|
if (isPanelDockConfig(config)) {
|
||||||
return new PanelDock(this, config);
|
widget = new PanelDock(this, config);
|
||||||
}
|
} else if (false) {
|
||||||
// others...
|
// others...
|
||||||
|
} else {
|
||||||
|
|
||||||
return new Dock(this, config);
|
widget = new Dock(this, config);
|
||||||
|
}
|
||||||
|
} else if (isPanelConfig(config)) {
|
||||||
|
widget = this.createPanel(config);
|
||||||
|
} else {
|
||||||
|
widget = new Widget(this, config as WidgetConfig);
|
||||||
}
|
}
|
||||||
if (isPanelConfig(config)) {
|
// ?
|
||||||
return this.createPanel(config);
|
// this.editor.set(`skeleton.${widget.name}`, widget);
|
||||||
}
|
return widget;
|
||||||
return new Widget(this, config as WidgetConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createPanel(config: PanelConfig) {
|
createPanel(config: PanelConfig) {
|
||||||
config = this.parseConfig(config);
|
config = this.parseConfig(config);
|
||||||
const panel = new Panel(this, config);
|
const panel = new Panel(this, config);
|
||||||
this.panels.set(panel.name, panel);
|
this.panels.set(panel.name, panel);
|
||||||
|
// ?
|
||||||
|
// this.editor.set(`skeleton.${panel.name}`, panel);
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
padding: 8px 12px 8px 16px;
|
padding: 8px;
|
||||||
.lc-top-area-left{}
|
.lc-top-area-left{}
|
||||||
.lc-top-area-center{
|
.lc-top-area-center{
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user