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();
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) {

View File

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