From ae9b48953e69fc77dec97c884fe7e93bcf1e9db2 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 25 May 2021 10:05:14 +0800 Subject: [PATCH] =?UTF-8?q?markdown=E5=AE=9A=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/render-html.jsx | 8 ++++---- src/forge/Main/CoderDepotReadme.jsx | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/render-html.jsx b/src/components/render-html.jsx index 3601ea323..4ffcc72a8 100644 --- a/src/components/render-html.jsx +++ b/src/components/render-html.jsx @@ -50,14 +50,14 @@ export default ({ } } } - },[url]) + },[url,html]) const el = useRef(); function onAncherHandler(e) { - let target = e.target + let target = e.target; if (target.tagName.toUpperCase() === 'A') { - let ancher = target.getAttribute('href') - if (ancher.startsWith('#')) { + let ancher = target.getAttribute('href'); + if (ancher && ancher.startsWith('#')) { e.preventDefault() let viewEl = document.getElementById(ancher.replace('#', '')) if (viewEl) { diff --git a/src/forge/Main/CoderDepotReadme.jsx b/src/forge/Main/CoderDepotReadme.jsx index e7e9826e3..135b0ee1a 100644 --- a/src/forge/Main/CoderDepotReadme.jsx +++ b/src/forge/Main/CoderDepotReadme.jsx @@ -58,9 +58,12 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){ :"" } -
- -
+ { + content && +
+ +
+ } ) }