diff --git a/src/forge/Information/Pages/help.jsx b/src/forge/Information/Pages/help.jsx index f456ebeae..bbcad47e7 100644 --- a/src/forge/Information/Pages/help.jsx +++ b/src/forge/Information/Pages/help.jsx @@ -23,7 +23,6 @@ function ProjectSource(props) { const [autoExpandParent, setAutoExpandParent] = useState(false); const [searchValue, setSearchValue] = useState(""); const [wikiContMenu, setWikiContMenu] = useState(undefined); - const [container, setContainer] = useState(undefined); const { temp, history, data, adminUrl } = props; let scroller = undefined; @@ -112,6 +111,7 @@ function ProjectSource(props) { }, [wikiDetail]) useEffect(() =>{ + // 点击事件 const handleClick = (event) => { let target = event.target; if (target.tagName.toUpperCase() === 'A') { @@ -127,9 +127,29 @@ function ProjectSource(props) { } } }; + + // 滚动 + const scroll = () =>{ + var element = document.getElementById('wikiContMenuBox'); + var scrollTop = document.documentElement.scrollTop||document.body.scrollTop; + var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; + var scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight; + if(scrollHeight-scrollTop <= windowHeight*1.2){ + const maxElementHeight = (scrollHeight-scrollTop)/2-200; + element && (element.style.maxHeight = maxElementHeight + 'px'); + }else if(scrollHeight-scrollTop <= windowHeight*1.5){ + const maxElementHeight = (scrollHeight-scrollTop)/2-100; + element && (element.style.maxHeight = maxElementHeight + 'px'); + }else{ + element && (element.style.maxHeight = '80vh'); + } + } + document.addEventListener("click", handleClick); + document.addEventListener("scroll", scroll); return () => { document.removeEventListener("click", handleClick); + document.removeEventListener("scroll", scroll); }; }, []) @@ -191,7 +211,7 @@ function ProjectSource(props) {

{data && data.helperTitle}

{ - wikiList && (wikiList.length > 0 ? {setContainer(node)}}> + wikiList && (wikiList.length > 0 ? {/* wiki目录导航 */}
{wikiDetail.md_content && } - {/* target={() => container} */} - {wikiContMenu && wikiContMenu !== "
    " && -
    + {wikiContMenu && wikiContMenu !== "
      " && +
      } }