This commit is contained in:
caishi 2021-04-20 15:31:49 +08:00
parent 1e0608aa14
commit 3b69c01ead
4 changed files with 33 additions and 23 deletions

View File

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

View File

@ -24,7 +24,7 @@ class CoderRootFileDetail extends Component {
}
componentDidMount = () => {
const { detail } = this.props;
const { detail , mdFlag } = this.props;
this.setState({
value: detail.content,
});
@ -176,9 +176,10 @@ class CoderRootFileDetail extends Component {
current_user,
isManager,
isDeveloper,
md,
currentBranch,
platform
platform,
md,
type
} = this.props;
const { language, languages, description } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper);
@ -197,17 +198,18 @@ class CoderRootFileDetail extends Component {
{readOnly ? (
<span>
{
detail.direct_download ?
""
:
!detail.direct_download?
<span>
<a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20">
<i className="iconfont icon-xiazai1 font-15 color-grey-6"></i>
</a>
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
</span>
{
type !==2 &&
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
}
</span>:""
}
</span>
) : (
@ -238,18 +240,21 @@ class CoderRootFileDetail extends Component {
</button>
</React.Fragment>
)}
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
{
type !==2 &&
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
}
</div>
)}
</p>

View File

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

View File

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