mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix links in toots opening the toot at first
This commit is contained in:
parent
80cefd5b3c
commit
e47b8e778b
@ -31,8 +31,6 @@ const StatusContent = React.createClass({
|
|||||||
link.setAttribute('target', '_blank');
|
link.setAttribute('target', '_blank');
|
||||||
link.setAttribute('rel', 'noopener');
|
link.setAttribute('rel', 'noopener');
|
||||||
}
|
}
|
||||||
|
|
||||||
link.addEventListener('click', this.onNormalClick, false);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -52,10 +50,6 @@ const StatusContent = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onNormalClick (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleMouseDown (e) {
|
handleMouseDown (e) {
|
||||||
this.startXY = [e.clientX, e.clientY];
|
this.startXY = [e.clientX, e.clientY];
|
||||||
},
|
},
|
||||||
@ -64,6 +58,10 @@ const StatusContent = React.createClass({
|
|||||||
const [ startX, startY ] = this.startXY;
|
const [ startX, startY ] = this.startXY;
|
||||||
const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)];
|
const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)];
|
||||||
|
|
||||||
|
if (e.target.localName === 'a' || (e.target.parentNode && e.target.parentNode.localName === 'a')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (deltaX + deltaY < 5) {
|
if (deltaX + deltaY < 5) {
|
||||||
this.props.onClick();
|
this.props.onClick();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user