markdown定位问题

This commit is contained in:
caishi 2021-05-25 10:05:14 +08:00
parent 3453aa31eb
commit ae9b48953e
2 changed files with 10 additions and 7 deletions

View File

@ -50,14 +50,14 @@ export default ({
} }
} }
} }
},[url]) },[url,html])
const el = useRef(); const el = useRef();
function onAncherHandler(e) { function onAncherHandler(e) {
let target = e.target let target = e.target;
if (target.tagName.toUpperCase() === 'A') { if (target.tagName.toUpperCase() === 'A') {
let ancher = target.getAttribute('href') let ancher = target.getAttribute('href');
if (ancher.startsWith('#')) { if (ancher && ancher.startsWith('#')) {
e.preventDefault() e.preventDefault()
let viewEl = document.getElementById(ancher.replace('#', '')) let viewEl = document.getElementById(ancher.replace('#', ''))
if (viewEl) { if (viewEl) {

View File

@ -58,9 +58,12 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
:"" :""
} }
</div> </div>
{
content &&
<div className="commonBox-info"> <div className="commonBox-info">
<RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/> <RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/>
</div> </div>
}
</div> </div>
) )
} }