|
@@ -31,7 +31,8 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
inputNumber: 1,
|
|
|
outputNumber: 1,
|
|
|
columns: [],
|
|
|
- tableData: []
|
|
|
+ tableData: [],
|
|
|
+ editorValue: ''
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -43,10 +44,9 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
|
|
|
// 保存编辑的代码
|
|
|
submitScriptEdit = () => {
|
|
|
- const editorValue = (this.editorRef.current as any).state.editor.getValue();
|
|
|
- this.props.nodeInfo.scriptText = editorValue;
|
|
|
this.setState({ scriptModalVisible: false });
|
|
|
- this.props.changeStatus(this.props.nodeInfo.nodeId);
|
|
|
+ const editorValue = (this.editorRef.current as any).state.editor.getValue();
|
|
|
+ this.setState({ editorValue: editorValue });
|
|
|
};
|
|
|
|
|
|
// 提交代码校验
|
|
@@ -59,7 +59,8 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
componentDidMount(): void {
|
|
|
this.setState({
|
|
|
inputNumber: this.props.nodeInfo.inputNumber,
|
|
|
- outputNumber: this.props.nodeInfo.outputNumber
|
|
|
+ outputNumber: this.props.nodeInfo.outputNumber,
|
|
|
+ editorValue: this.props.nodeInfo.scriptText
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -70,6 +71,7 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
this.props.nodeInfo.nodeName = nodeName;
|
|
|
this.props.nodeInfo.nodeId = nodeId;
|
|
|
this.props.nodeInfo.outputNumber = this.state.outputNumber;
|
|
|
+ this.props.nodeInfo.scriptText = this.state.editorValue;
|
|
|
this.updateInputPorts(this.state.inputNumber);
|
|
|
this.updateOutputPorts(this.state.outputNumber);
|
|
|
this.props.node.setData({ ...this.props.nodeInfo });
|
|
@@ -88,7 +90,8 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
);
|
|
|
this.setState({
|
|
|
inputNumber: this.props.nodeInfo.inputNumber,
|
|
|
- outputNumber: this.props.nodeInfo.outputNumber
|
|
|
+ outputNumber: this.props.nodeInfo.outputNumber,
|
|
|
+ editorValue: this.props.nodeInfo.scriptText
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -403,8 +406,9 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
|
|
|
<div className="script-header"></div>
|
|
|
<ScriptEditor
|
|
|
inputNumber={this.state.inputNumber}
|
|
|
+ outputNumber={this.state.outputNumber}
|
|
|
type={this.props.nodeInfo.label}
|
|
|
- scriptText={this.props.nodeInfo.scriptText}
|
|
|
+ scriptText={this.state.editorValue}
|
|
|
ref={this.editorRef as any}
|
|
|
/>
|
|
|
</div>
|