mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:16:08 +08:00
FIX: text selection breaks opening of links in new tabs (#19867)
When a user checks "Open all external links in a new tab" preference he expects not to be overruled by unrelated text selections. Yet if text is selected during a link click the link is followed on the same tab. This change corrects that.
This commit is contained in:
parent
eee97ad29a
commit
1bc39c1a4f
|
@ -5,7 +5,6 @@ import User from "discourse/models/user";
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import getURL, { samePrefix } from "discourse-common/lib/get-url";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
import { selectedText } from "discourse/lib/utilities";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
import deprecated from "discourse-common/lib/deprecated";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
|
@ -80,14 +79,6 @@ export default {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Cancel click if triggered as part of selection.
|
||||
const selection = window.getSelection();
|
||||
if (selection.type === "Range" || selection.rangeCount > 0) {
|
||||
if (selectedText() !== "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const link = e.currentTarget;
|
||||
const tracking = isValidLink(link);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user