From e9619542ea3d0903ee660db1f244ebcd6d35cf3e Mon Sep 17 00:00:00 2001 From: caishi Date: Sat, 9 Oct 2021 13:37:56 +0800 Subject: [PATCH] =?UTF-8?q?md=E5=A2=9E=E5=8A=A0=E7=9B=AE=E5=BD=95=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Branch/Select.jsx | 2 +- src/forge/DevOps/Dispose/PipelineName.jsx | 2 +- src/forge/DevOps/ssh/XmlPanel.jsx | 3 - src/forge/Head/Header.js | 3 +- src/forge/Main/CoderDepot.jsx | 9 +- src/forge/Main/CoderDepotPath.jsx | 1 - src/forge/Main/CoderRootFileDetail.js | 179 +++++++++++++--------- src/forge/Main/Index.scss | 20 +++ src/forge/Main/list.scss | 3 + src/forge/Main/sub/ReadmeCatelogue.jsx | 6 +- 10 files changed, 142 insertions(+), 86 deletions(-) diff --git a/src/forge/Branch/Select.jsx b/src/forge/Branch/Select.jsx index 8083082da..b74d558fc 100644 --- a/src/forge/Branch/Select.jsx +++ b/src/forge/Branch/Select.jsx @@ -51,7 +51,7 @@ export default (({ projectsId , branch , owner , changeBranch , branchList , tag ); return( -
setVisible(true)}> +
setVisible(visible ? false : true)}> {/* {nav === 0 ?"分支":"标签"} */} diff --git a/src/forge/DevOps/Dispose/PipelineName.jsx b/src/forge/DevOps/Dispose/PipelineName.jsx index 4acaa2068..63ee54378 100644 --- a/src/forge/DevOps/Dispose/PipelineName.jsx +++ b/src/forge/DevOps/Dispose/PipelineName.jsx @@ -51,7 +51,7 @@ function PipelineName({visible,onCancel,onOk,value ,branchList}){ }) } - {setEventValue(e)}}> { EVENT.map((item,key)=>{ return( diff --git a/src/forge/DevOps/ssh/XmlPanel.jsx b/src/forge/DevOps/ssh/XmlPanel.jsx index ae642caa3..295d96ce0 100644 --- a/src/forge/DevOps/ssh/XmlPanel.jsx +++ b/src/forge/DevOps/ssh/XmlPanel.jsx @@ -24,7 +24,6 @@ function onLayout(term, el) { entry.target.offsetHeight, term, ); - console.log('cols, rows', cols, rows); term.resize(cols, rows); mediator.publish('ssh-xterm-resize', { columns: cols, @@ -139,12 +138,10 @@ export default ({ sshConfigData, sid }) => { }, 1000); } isFirstConnected.current = true; - console.log('event:', event); const data = Base64.decode(event.data.toString()); let w = term._core._renderService.dimensions.actualCellWidth || 9.5; - console.log('data:', data, w, term); term.write(data); }; diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 41d7fcfd3..59513153b 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -120,7 +120,6 @@ class NewHeader extends Component { }) }; HideAddcoursestypess = (i) => { - console.log("调用了"); this.setState({ Addcoursestypes: false, mydisplay: true, @@ -269,7 +268,7 @@ class NewHeader extends Component { ) }) } -
  • 设置
  • + {/*
  • 设置
  • */} this.educoderloginysl()}>退出 ) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index bcbcd348f..7f3c66cc7 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -340,6 +340,7 @@ function CoderDepot(props){ const mdFlag = n && n.substring(n.length-3,n.length) === ".md"; const { current_user } = props; + const baseOper = projectDetail && projectDetail.permission; const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter"; const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin)); @@ -420,14 +421,14 @@ function CoderDepot(props){ { - baseOperate && ((projectDetail.type !== 2 && pullsFlag) || issuesFlag )&& + ((baseOperate && projectDetail.type !== 2 && pullsFlag) || (baseOper && issuesFlag)) &&
    { - projectDetail.type !== 2 && pullsFlag && + baseOperate && projectDetail.type !== 2 && pullsFlag && urlLink(`/${owner}/${projectsId}/pulls/new/${branchName || defaultBranch}`)} >+ 合并请求 } { - issuesFlag && + baseOper && issuesFlag && urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 易修 }
    @@ -576,7 +577,7 @@ function CoderDepot(props){ } {/* 语言 */} - { projectDetail && projectDetail.languages && + { projectDetail && projectDetail.languages && diff --git a/src/forge/Main/CoderDepotPath.jsx b/src/forge/Main/CoderDepotPath.jsx index f601a8d28..89d6a5ca3 100644 --- a/src/forge/Main/CoderDepotPath.jsx +++ b/src/forge/Main/CoderDepotPath.jsx @@ -13,7 +13,6 @@ function CoderDepotPath({treeValuePath , returnUlr , returnMain , getPathUrl , i {identifier} {treeValuePath.map((item, key) => { - console.log(result) return ( { diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index d5a9670c6..c6c976f47 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -1,10 +1,12 @@ import React, { Component } from "react"; -import { Popconfirm , Select } from "antd"; +import { Popconfirm , Select , Dropdown , Spin , Anchor } from "antd"; import "./list.scss"; import axios from "axios"; import Meditor from "../Newfile/m_editor"; import RenderHtml from "../../components/render-html"; +import ReadmeCatelogue from "./sub/ReadmeCatelogue"; +const $ = window.$; function bytesToSize(bytes) { if (bytes === 0) return "0 B"; let k = 1024, @@ -19,7 +21,8 @@ class CoderRootFileDetail extends Component { value: undefined, language: undefined, languages: undefined, - description: props.detail.content + description: props.detail.content, + menuList:undefined }; } @@ -169,6 +172,31 @@ class CoderRootFileDetail extends Component { }); }; + renderMenulist=()=>{ + const { description } = this.state; + if(description){ + const items = $.map($("#files-md").find("h1,h2,h3,h4,h5,h6"), function (el, _) { + const anchor = el.id; + const level = el.tagName.replace("H", ""); + const href = `#${anchor}`; + return { href:`${href}`,text:el.textContent , level:level } + }); + return items; + } + return []; + } + + menu=()=>{ + const menuList = this.renderMenulist(); + if(menuList && menuList.length > 0){ + return( + + ) + }else{ + return + } + } + render() { const { readOnly, @@ -186,79 +214,88 @@ class CoderRootFileDetail extends Component { const Option = Select.Option; return ( -
    -
    - + +
    + { + md && readOnly && + + + + 目录 + + + } + {bytesToSize(detail && detail.size)}

    - {flag && platform && ( -

    - {readOnly ? ( - - { - !detail.direct_download? - - this.DownLoadFile(detail.download_url)} className="ml20"> - - - { - type !==2 && - this.EditFile(false)} className="ml20"> - + {flag && platform && ( +
    + {readOnly ? ( + + { + !detail.direct_download? + + this.DownLoadFile(detail.download_url)} className="ml20"> + - } - :"" - } - - ) : ( - - - - - )} - { - type !==2 && - - - - - - } - -
    - )} -

    -
    + { + type !==2 && + this.EditFile(false)} className="ml20"> + + + } +
    :"" + } + + ) : ( + + + + + )} + { + type !==2 && + + + + + + } + +
    + )} +

    +
    {detail.image_type ? (
    @@ -272,7 +309,7 @@ class CoderRootFileDetail extends Component {
    ) : ( md && readOnly ? -
    +
    : diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index 8c0e18488..a19bd80da 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -461,4 +461,24 @@ .coderSubPage{ width: 1200px; margin:0px auto; +} +.griditemAnchor{ + margin-left: 0px; + padding: 0px; + border-bottom: 1px solid #ddd; + .ant-anchor{ + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 20px; + } + .griditemCate{ + color: #333; + font-size: 16px; + display: flex; + align-items: center; + .catelogue{ + margin-left: 0px; + } + } } \ No newline at end of file diff --git a/src/forge/Main/list.scss b/src/forge/Main/list.scss index 0d77ff431..73b534de9 100644 --- a/src/forge/Main/list.scss +++ b/src/forge/Main/list.scss @@ -575,6 +575,9 @@ border:1px solid #ddd; margin-top: 18px; border-radius: 4px; + .ant-anchor-wrapper{ + overflow: unset!important; + } } .commonBox .commonBox-title{ padding:0px 20px; diff --git a/src/forge/Main/sub/ReadmeCatelogue.jsx b/src/forge/Main/sub/ReadmeCatelogue.jsx index d1e018bb6..6dab7d792 100644 --- a/src/forge/Main/sub/ReadmeCatelogue.jsx +++ b/src/forge/Main/sub/ReadmeCatelogue.jsx @@ -1,7 +1,7 @@ -import React , { useState , useEffect } from 'react'; +import React , { useState } from 'react'; import { Anchor , Input } from 'antd'; import './sub.scss'; -import { Base64 } from 'js-base64'; +import { useEffect } from 'react'; const { Link } = Anchor; @@ -18,7 +18,7 @@ function ReadmeCatelogue({ menuList , hash }) { function changeValue(e) { setValue(e.target.value); if(e.target.value){ - let m = menuList.filter(i=>i.text.indexOf(e.target.value)>-1); + let m = menuList.filter(i=>i.text.toLowerCase().indexOf(e.target.value.toLowerCase())>-1); setMenu(m); }else{ setMenu(menuList);