fix: fix function-setter bug

This commit is contained in:
zude.hzd 2020-08-27 16:00:07 +08:00
parent f81932b4bc
commit dced647917
2 changed files with 40 additions and 4 deletions

View File

@ -62,10 +62,14 @@ export default class FunctionSetter extends PureComponent<FunctionSetterProps, {
parseFunctionName = (functionString: String) => {
// 因为函数格式是固定的,所以可以按照字符换去匹配获取函数名
let funNameStr = functionString.split('.')[1];
let endIndex = funNameStr.indexOf('(');
return funNameStr.substr(0, endIndex);
if (funNameStr){
let endIndex = funNameStr.indexOf('(');
return funNameStr.substr(0, endIndex);
}else{
return '匿名函数'
}
}
/**

View File

@ -1,8 +1,34 @@
import { Component, isValidElement, ReactElement, ReactNode } from 'react';
import { Dialog, Search, Input } from '@alifd/next';
import { PluginProps } from '@ali/lowcode-types';
import MonacoEditor from 'react-monaco-editor';
import './index.scss';
const defaultEditorOption = {
width: '100%',
height: '319px',
options: {
readOnly: false,
automaticLayout: true,
folding: true, //默认开启折叠代码功能
lineNumbers: 'on',
wordWrap: 'off',
formatOnPaste: true,
fontSize: 12,
tabSize: 2,
scrollBeyondLastLine: false,
fixedOverflowWidgets: false,
snippetSuggestions: 'top',
minimap: {
enabled: false,
},
scrollbar: {
vertical: 'auto',
horizontal: 'auto',
},
},
};
export default class EventBindDialog extends Component<PluginProps> {
private eventList: any[] = [
// {
@ -180,7 +206,13 @@ export default class EventBindDialog extends Component<PluginProps> {
</div>
<div className="dialog-small-title"></div>
<Input.TextArea style={{ width: '100%', height: '319px' }} />
<MonacoEditor
value={'{}'}
{...defaultEditorOption}
{...{ language: 'json' }}
// onChange={(newCode) => this.updateCode(newCode)}
// editorDidMount={(editor, monaco) => this.editorDidMount.call(this, editor, monaco, TAB_KEY.JS_TAB)}
/>
</div>
</div>
</Dialog>