diff --git a/src/forge/Main/CoderDepotReadme.jsx b/src/forge/Main/CoderDepotReadme.jsx index c4674740..da1435d5 100644 --- a/src/forge/Main/CoderDepotReadme.jsx +++ b/src/forge/Main/CoderDepotReadme.jsx @@ -1,13 +1,49 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import RenderHtml from '../../components/render-html'; +import { Dropdown , Menu , Spin } from 'antd'; +import { Link } from 'react-router-dom'; +const $ = window.$; function CoderDepotReadme({ operate , history , readme , ChangeFile }){ + const [ menuList ,setMenuList ] = useState(undefined); + + useEffect(()=>{ + if(readme && readme.content){ + let path = history.location.pathname; + const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { + const anchor = el.id; + const level = el.tagName.replace("H", ""); + const href = `#${anchor}`; + return { href:`${path}${href}`,text:el.textContent , level:level } + }); + setMenuList(items); + } + },[readme]) + + function menu(){ + if(menuList && menuList.length > 0){ + let hash = history.location.hash; + return( + + { + menuList.map((item,key)=>{ + return( + -1 ?"active":""}>{item.text} + ) + }) + } + + ) + }else{ + return + } + } return(
- - - + + + README.md { operate ? diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index e144a33d..ed6b7da4 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -273,4 +273,23 @@ .downMenu{ box-shadow: 0px 0px 9px rgba(134, 134, 134,0.4); background-color: #fff; +} + +.menuslist{ + max-height: 200px; + overflow-y: auto; + padding:10px 15px; + border-radius: 4px; + .ant-dropdown-menu-item{ + border-radius: 8px; + a{ + width: 350px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + .ant-dropdown-menu-item.active{ + background-color: #e6f7ff; + } } \ No newline at end of file diff --git a/src/modules/tpm/TPMIndex.css b/src/modules/tpm/TPMIndex.css index 47696ec9..7b4d15a7 100644 --- a/src/modules/tpm/TPMIndex.css +++ b/src/modules/tpm/TPMIndex.css @@ -21,7 +21,6 @@ body>.-task-title { height: 100%; min-height: 100%; overflow: hidden; - padding-top:70px; } .newHeaders{ max-width: unset; diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 0a1d1c48..0aa89c49 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -397,6 +397,7 @@ export function TPMIndexHOC(WrappedComponent) { tip={this._gLoadingTip || "加载中..."} >
+
{ current_user && this.initCommonState(user)}