Prevent user contextmenu from opening while selecting text
This commit is contained in:
parent
b3702b0550
commit
e77de3315a
@ -170,6 +170,12 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
viewport.on("click contextmenu", ".user", function(e) {
|
viewport.on("click contextmenu", ".user", function(e) {
|
||||||
|
// If user is selecting text, do not open context menu
|
||||||
|
// This primarily only targets mobile devices where selection is performed with touch
|
||||||
|
if (!window.getSelection().isCollapsed) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return showContextMenu(this, e);
|
return showContextMenu(this, e);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -218,13 +224,7 @@ $(function() {
|
|||||||
|
|
||||||
chat.on("click", ".chat", function() {
|
chat.on("click", ".chat", function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var text = "";
|
if (window.getSelection().isCollapsed) {
|
||||||
if (window.getSelection) {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (document.selection && document.selection.type !== "Control") {
|
|
||||||
text = document.selection.createRange().text;
|
|
||||||
}
|
|
||||||
if (!text) {
|
|
||||||
focus();
|
focus();
|
||||||
}
|
}
|
||||||
}, 2);
|
}, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user