|
|
|
@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
|
|
|
|
|
imageSrc: ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDelegateClick = (event) => {
|
|
|
|
|
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
|
|
|
|
|
// 判断imageSrc是否是图片
|
|
|
|
@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// jQuery._data( $('.newMain')[0], "events" )
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef'])
|
|
|
|
@ -45,6 +47,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
|
|
|
|
|
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick);
|
|
|
|
|
}, 1200)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
$(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick)
|
|
|
|
|
}
|
|
|
|
@ -55,9 +58,24 @@ export function ImageLayerOfCommentHOC(options = {}) {
|
|
|
|
|
imageSrc: '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MdifHasAnchorJustScorll=()=>{
|
|
|
|
|
//mdhash滚动
|
|
|
|
|
let anchor = decodeURI(this.props.location.hash).replace('#', '');
|
|
|
|
|
// 对应id的话, 滚动到相应位置
|
|
|
|
|
if (!!anchor) {
|
|
|
|
|
let anchorElement = document.getElementsByName(anchor);
|
|
|
|
|
if (anchorElement) {
|
|
|
|
|
if (anchorElement.length!=0) {
|
|
|
|
|
anchorElement[0].scrollIntoView();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
|
|
|
|
|
this.MdifHasAnchorJustScorll();
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>
|
|
|
|
|