From b1782551bde1955b66af38c516315fec0d1ed938 Mon Sep 17 00:00:00 2001 From: smallstonesk <575913857@qq.com> Date: Tue, 19 Jan 2021 11:36:03 +0800 Subject: [PATCH] feat: add runCode button in CodeEditorModal's footer --- .../src/mods/flowChart/codeEditorModel/index.tsx | 15 ++++++++++----- .../mods/flowChart/codeRunModal/index.module.less | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/core/src/mods/flowChart/codeEditorModel/index.tsx b/packages/core/src/mods/flowChart/codeEditorModel/index.tsx index 98b1360..4113498 100644 --- a/packages/core/src/mods/flowChart/codeEditorModel/index.tsx +++ b/packages/core/src/mods/flowChart/codeEditorModel/index.tsx @@ -7,7 +7,7 @@ import 'antd/es/modal/style'; import styles from './index.module.less'; import { Graph } from '@antv/x6'; -import { Modal, message } from 'antd'; +import { Button, Modal, message } from 'antd'; import JsonView from 'react-json-view'; import { safeParse } from '../../../utils'; import analyzeDeps from '../../../utils/analyzeDeps'; @@ -85,7 +85,10 @@ const CodeEditModal: React.FC = (props) => { }; const onCancel = (): void => { setVisible(false); - } + }; + const onRunCode = (): void => { + flowChart.trigger('graph:runCode'); + }; const onChangeCode = (ev: any, newCode: string | undefined = ''): void => { setCode(newCode); }; @@ -98,11 +101,13 @@ const CodeEditModal: React.FC = (props) => { className={styles.modal} width={1000} title={title} - okText={'保存'} visible={visible} - cancelText={'取消'} - onOk={onOk} onCancel={onCancel} + footer={[ + , + , + , + ]} >