Fix: Cancel link click if triggered as part of text selection

Prevent a click if the user select content in a topic and release the mouse over a link.

https://meta.discourse.org/t/selecting-a-link-results-in-it-being-opened/14846
This commit is contained in:
lidlanca 2014-09-13 04:05:03 -04:00
parent 46d8db3d70
commit 13cedce0cf

View File

@ -14,6 +14,7 @@ Discourse.ClickTrack = {
@param {jQuery.Event} e The click event that occurred
**/
trackClick: function(e) {
if (Discourse.Utilities.selectedText()!=="") return false; //cancle click if triggered as part of selection.
var $link = $(e.currentTarget);
if ($link.hasClass('lightbox')) return true;