diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 4102fd754..a9c73fee6 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -46,8 +46,9 @@ class CoderRootDirectory extends Component { chooseType:undefined, tags_count:undefined, commits_count:undefined, - branches_count:undefined + branches_count:undefined, + md:false } } changeAddress = (address) => { @@ -254,12 +255,21 @@ class CoderRootDirectory extends Component { }; // 点击跳转到子目录 - goToSubRoot=(path,type)=>{ + goToSubRoot=(path,type,filename)=>{ this.setState({ chooseType:type }) const { projectsId } = this.props.match.params; this.props.history.push(`/projects/${projectsId}/coders?url=${path}`); + if(filename.substring(filename.length - 3) === ".md"){ + this.setState({ + md:true + }) + }else{ + this.setState({ + md:false + }) + } }; // readme文件内容 @@ -348,7 +358,7 @@ class CoderRootDirectory extends Component { dataIndex: 'name', width:"30%", render: (text,item) => ( - this.goToSubRoot(item.path,item.type)} className="ml12 task-hide" style={{ display: "block", maxWidth: "345px" }}> + this.goToSubRoot(item.path,item.type,text)} className="ml12 task-hide" style={{ display: "block", maxWidth: "345px" }}> {text} ), diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index 7430d0bbe..1ba64db04 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -3,6 +3,9 @@ import { Popconfirm, Select } from "antd"; import "./list.css"; import axios from "axios"; import Meditor from "../Newfile/m_editor"; +import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; +import RenderHtml from "../../components/render-html"; + function bytesToSize(bytes) { if (bytes === 0) return "0 B"; @@ -18,6 +21,7 @@ class CoderRootFileDetail extends Component { value: undefined, language: undefined, languages: undefined, + description:props.detail.content }; } @@ -146,6 +150,12 @@ class CoderRootFileDetail extends Component { }); }; + onContentChange = (value) => { + this.setState({ + description: value, + }); + }; + render() { const { readOnly, @@ -153,8 +163,9 @@ class CoderRootFileDetail extends Component { current_user, isManager, isDeveloper, + md } = this.props; - const { language, languages } = this.state; + const { language, languages , description } = this.state; let flag = current_user && current_user.login && (isManager || isDeveloper); const Option = Select.Option; @@ -233,6 +244,11 @@ class CoderRootFileDetail extends Component { ) : ( + md && readOnly ? +