mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 11:15:43 +03:00
Match logic for context menu and long press
This commit is contained in:
parent
6f430ca0f5
commit
4001e1c47a
1 changed files with 5 additions and 5 deletions
|
@ -679,6 +679,8 @@ function Status({
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const showContextMenu = size !== 'l' && !previewMode && !_deleted;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article
|
<article
|
||||||
ref={statusRef}
|
ref={statusRef}
|
||||||
|
@ -694,10 +696,8 @@ function Status({
|
||||||
} ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''}`}
|
} ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''}`}
|
||||||
onMouseEnter={debugHover}
|
onMouseEnter={debugHover}
|
||||||
onContextMenu={(e) => {
|
onContextMenu={(e) => {
|
||||||
if (size === 'l') return;
|
if (!showContextMenu) return;
|
||||||
if (e.metaKey) return;
|
if (e.metaKey) return;
|
||||||
if (previewMode) return;
|
|
||||||
if (_deleted) return;
|
|
||||||
// console.log('context menu', e);
|
// console.log('context menu', e);
|
||||||
const link = e.target.closest('a');
|
const link = e.target.closest('a');
|
||||||
if (link && /^https?:\/\//.test(link.getAttribute('href'))) return;
|
if (link && /^https?:\/\//.test(link.getAttribute('href'))) return;
|
||||||
|
@ -708,9 +708,9 @@ function Status({
|
||||||
});
|
});
|
||||||
setIsContextMenuOpen(true);
|
setIsContextMenuOpen(true);
|
||||||
}}
|
}}
|
||||||
{...bindLongPress()}
|
{...(showContextMenu ? bindLongPress() : {})}
|
||||||
>
|
>
|
||||||
{size !== 'l' && (
|
{showContextMenu && (
|
||||||
<ControlledMenu
|
<ControlledMenu
|
||||||
ref={contextMenuRef}
|
ref={contextMenuRef}
|
||||||
state={isContextMenuOpen ? 'open' : undefined}
|
state={isContextMenuOpen ? 'open' : undefined}
|
||||||
|
|
Loading…
Reference in a new issue