md文件要用Markdown渲染

This commit is contained in:
caishi 2021-04-20 15:31:49 +08:00
parent ffbb5ba34e
commit 8fa31edaae
4 changed files with 8 additions and 3 deletions

View File

@ -230,6 +230,10 @@ function CoderDepot(props){
} }
}) })
} }
let n = fileInfo && fileInfo.name;
const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
return( return(
<WhiteBack> <WhiteBack>
<UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/> <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
@ -353,6 +357,7 @@ function CoderDepot(props){
{...props} {...props}
detail={fileInfo} detail={fileInfo}
readOnly={readOnly} readOnly={readOnly}
md={mdFlag}
onEdit={onEdit} onEdit={onEdit}
currentBranch={branchName || (projectDetail && projectDetail.default_branch)} currentBranch={branchName || (projectDetail && projectDetail.default_branch)}
type={projectDetail.type} type={projectDetail.type}

View File

@ -24,7 +24,7 @@ class CoderRootFileDetail extends Component {
} }
componentDidMount = () => { componentDidMount = () => {
const { detail } = this.props; const { detail , mdFlag } = this.props;
this.setState({ this.setState({
value: detail.content, value: detail.content,
}); });
@ -176,9 +176,9 @@ class CoderRootFileDetail extends Component {
current_user, current_user,
isManager, isManager,
isDeveloper, isDeveloper,
md,
currentBranch, currentBranch,
platform, platform,
md,
type type
} = this.props; } = this.props;
const { language, languages, description } = this.state; const { language, languages, description } = this.state;

View File

@ -295,6 +295,7 @@
border-radius: 4px; border-radius: 4px;
.ant-dropdown-menu-item{ .ant-dropdown-menu-item{
border-radius: 8px; border-radius: 8px;
text-align: left;
a{ a{
width: 350px; width: 350px;
overflow: hidden; overflow: hidden;

View File

@ -281,7 +281,6 @@
height:100%; height:100%;
} }
.files-md{ .files-md{
border:1px solid #eee;
padding:20px; padding:20px;
} }
/* 详情-代码 */ /* 详情-代码 */