Fix some links not opening browser's context menu

pull/441/head
Lim Chee Aun 2024-03-01 10:29:38 +08:00
rodzic 1bf8616957
commit ab0472de02
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -1085,7 +1085,7 @@ function Status({
const { clientX, clientY } = e.touches?.[0] || e;
// link detection copied from onContextMenu because here it works
const link = e.target.closest('a');
if (link && /^https?:\/\//.test(link.getAttribute('href'))) return;
if (link && statusRef.current.contains(link)) return;
e.preventDefault();
setContextMenuProps({
anchorPoint: {
@ -1331,7 +1331,7 @@ function Status({
if (e.metaKey) return;
// console.log('context menu', e);
const link = e.target.closest('a');
if (link && /^https?:\/\//.test(link.getAttribute('href'))) return;
if (link && statusRef.current.contains(link)) return;
// If there's selected text, don't show custom context menu
const selection = window.getSelection?.();