]> cat aescling's git repositories - mastodon.git/commitdiff
Fix links in toots opening the toot at first
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 24 Jan 2017 17:51:09 +0000 (18:51 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 24 Jan 2017 17:51:09 +0000 (18:51 +0100)
app/assets/javascripts/components/components/status_content.jsx

index 68224b7ba8cc4a642d87b0a97c1e1f801f9416bf..1ee720c9bda3058e2cf316e19055db8c42f96cf5 100644 (file)
@@ -31,8 +31,6 @@ const StatusContent = React.createClass({
         link.setAttribute('target', '_blank');
         link.setAttribute('rel', 'noopener');
       }
-
-      link.addEventListener('click', this.onNormalClick, false);
     }
   },
 
@@ -52,10 +50,6 @@ const StatusContent = React.createClass({
     }
   },
 
-  onNormalClick (e) {
-    e.stopPropagation();
-  },
-
   handleMouseDown (e) {
     this.startXY = [e.clientX, e.clientY];
   },
@@ -64,6 +58,10 @@ const StatusContent = React.createClass({
     const [ startX, startY ] = this.startXY;
     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) {
       this.props.onClick();
     }