You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/public/react/src/modules/developer/newOrEditTask/rightpane/index.js

79 lines
1.9 KiB

/*
* @Description:
* @Author: tangjiang
* @Github:
* @Date: 2019-12-01 10:18:35
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-09 11:38:15
*/
import './index.scss';
import React from 'react';
import { connect } from 'react-redux';
import MyMonacoEditor from '../../components/myMonacoEditor';
// import ControlSetting from '../../components/controlSetting';
import actions from '../../../../redux/actions';
function RightPane (props, ref) {
const {
// identifier,
// code,
// onSubmitForm,
saveOjFormCode
} = props;
// let timer = null;
// 代码改变时,保存
const handleCodeChange = (updateCode) => {
// 保存用户输入的代码
// if (!timer) {
// timer = setInterval(() => {
// clearInterval(timer);
// timer = null;
// if (updateCode) {
// console.log('调用更新代码------>>>>>>', updateCode);
// }
// }, 3000);
// }
saveOjFormCode(updateCode);
}
// 启动调试代码
// const handleDebuggerCode = (value) => {
// console.log('调用的代码调试====', value);
// }
return (
<div className={'right_pane_code_wrap'}>
<MyMonacoEditor
language={props.language}
code={props.code}
onCodeChange={handleCodeChange}/>
{/* <ControlSetting
// identifier={identifier}
inputValue={props.input}
onSubmitForm={onSubmitForm}
// onDebuggerCode={handleDebuggerCode}
/> */}
</div>
)
}
const mapStateToProps = (state) => {
const { ojForm, testCases, code, identifier } = state.ojFormReducer;
return {
code,
identifier,
language: ojForm.language,
input: (testCases[0] && testCases[0].input) || '',
}
};
const mapDispatchToProps = (dispatch) => ({
// 保存提交的代码值
saveOjFormCode: (value) => dispatch(actions.saveOjFormCode(value)),
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(RightPane);