mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-25 18:55:44 +03:00
Custom context menu if link has hash
This commit is contained in:
parent
a0367f4860
commit
4843970e1b
1 changed files with 12 additions and 2 deletions
|
@ -1100,7 +1100,12 @@ 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 && statusRef.current.contains(link)) return;
|
||||
if (
|
||||
link &&
|
||||
statusRef.current.contains(link) &&
|
||||
!link.getAttribute('href').startsWith('#')
|
||||
)
|
||||
return;
|
||||
e.preventDefault();
|
||||
setContextMenuProps({
|
||||
anchorPoint: {
|
||||
|
@ -1346,7 +1351,12 @@ function Status({
|
|||
if (e.metaKey) return;
|
||||
// console.log('context menu', e);
|
||||
const link = e.target.closest('a');
|
||||
if (link && statusRef.current.contains(link)) return;
|
||||
if (
|
||||
link &&
|
||||
statusRef.current.contains(link) &&
|
||||
!link.getAttribute('href').startsWith('#')
|
||||
)
|
||||
return;
|
||||
|
||||
// If there's selected text, don't show custom context menu
|
||||
const selection = window.getSelection?.();
|
||||
|
|
Loading…
Reference in a new issue