affected, replaced onClick handler with onMouseUp/Down to detect text selection not trigger onClick handler then
This commit is contained in:
@ -56,12 +56,35 @@ const StatusContent = React.createClass({
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
handleMouseDown (e) {
|
||||
this.startXY = [e.clientX, e.clientY];
|
||||
},
|
||||
|
||||
handleMouseUp (e) {
|
||||
const [ startX, startY ] = this.startXY;
|
||||
const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)];
|
||||
|
||||
if (deltaX + deltaY < 5) {
|
||||
this.props.onClick();
|
||||
}
|
||||
|
||||
this.startXY = null;
|
||||
},
|
||||
|
||||
render () {
|
||||
const { status, onClick } = this.props;
|
||||
const { status } = this.props;
|
||||
|
||||
const content = { __html: emojify(status.get('content')) };
|
||||
|
||||
return <div className='status__content' style={{ cursor: 'pointer' }} dangerouslySetInnerHTML={content} onClick={onClick} />;
|
||||
return (
|
||||
<div
|
||||
className='status__content'
|
||||
style={{ cursor: 'pointer' }}
|
||||
dangerouslySetInnerHTML={content}
|
||||
onMouseDown={this.handleMouseDown}
|
||||
onMouseUp={this.handleMouseUp}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
});
|
||||
|
@ -60,6 +60,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
.invisible {
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
&:after {
|
||||
content: "…";
|
||||
}
|
||||
}
|
||||
|
||||
.lightbox .icon-button {
|
||||
color: $color1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user