forked from Gitlink/forgeplus-react
a链接包含图片,点击图片不放大直接跳转到a链接地址
This commit is contained in:
parent
b04fbbd976
commit
d6df119fd2
|
|
@ -73,11 +73,7 @@
|
|||
window.location.hash = $(this).attr("name");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
// window.addEventListener("popstate", function(e) {
|
||||
// console.log("popstate",e);
|
||||
// history.go(-2);
|
||||
// }, false);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,20 +16,25 @@ export function ImageLayerOfCommentHOC(options = {}) {
|
|||
onDelegateClick = (event) => {
|
||||
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
|
||||
// 判断imageSrc是否是图片
|
||||
const fileName = event.target.innerHTML.trim()
|
||||
if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG') {
|
||||
// 非回复里的头像图片; 非emoticons
|
||||
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
|
||||
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1) {
|
||||
this.setState({
|
||||
showImage: true,
|
||||
imageSrc,
|
||||
})
|
||||
const fileName = event.target.innerHTML.trim();
|
||||
const parentNodeUrl = event.target.parentNode && event.target.parentNode.getAttribute('href');
|
||||
if(parentNodeUrl){
|
||||
window.location.href = parentNodeUrl;
|
||||
}else{
|
||||
if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG') {
|
||||
// 非回复里的头像图片; 非emoticons
|
||||
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
|
||||
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1) {
|
||||
this.setState({
|
||||
showImage: true,
|
||||
imageSrc,
|
||||
})
|
||||
}
|
||||
event.stopPropagation()
|
||||
event.preventDefault && event.preventDefault()
|
||||
event.originalEvent.preventDefault()
|
||||
return false;
|
||||
}
|
||||
event.stopPropagation()
|
||||
event.preventDefault && event.preventDefault()
|
||||
event.originalEvent.preventDefault()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue