From d6df119fd2cde2fcb1e015f245c8be03f71bbbed Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 20 Jul 2023 18:46:43 +0800 Subject: [PATCH] =?UTF-8?q?a=E9=93=BE=E6=8E=A5=E5=8C=85=E5=90=AB=E5=9B=BE?= =?UTF-8?q?=E7=89=87,=E7=82=B9=E5=87=BB=E5=9B=BE=E7=89=87=E4=B8=8D?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?a=E9=93=BE=E6=8E=A5=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 6 +--- .../page/layers/ImageLayerOfCommentHOC.js | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/public/index.html b/public/index.html index c009e1284..647288a0c 100755 --- a/public/index.html +++ b/public/index.html @@ -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); + } diff --git a/src/modules/page/layers/ImageLayerOfCommentHOC.js b/src/modules/page/layers/ImageLayerOfCommentHOC.js index a2482612f..3e51d8c13 100644 --- a/src/modules/page/layers/ImageLayerOfCommentHOC.js +++ b/src/modules/page/layers/ImageLayerOfCommentHOC.js @@ -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; } }