mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 17:25:40 +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 (
|
||||
<article
|
||||
ref={statusRef}
|
||||
|
@ -694,10 +696,8 @@ function Status({
|
|||
} ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''}`}
|
||||
onMouseEnter={debugHover}
|
||||
onContextMenu={(e) => {
|
||||
if (size === 'l') return;
|
||||
if (!showContextMenu) return;
|
||||
if (e.metaKey) return;
|
||||
if (previewMode) return;
|
||||
if (_deleted) return;
|
||||
// console.log('context menu', e);
|
||||
const link = e.target.closest('a');
|
||||
if (link && /^https?:\/\//.test(link.getAttribute('href'))) return;
|
||||
|
@ -708,9 +708,9 @@ function Status({
|
|||
});
|
||||
setIsContextMenuOpen(true);
|
||||
}}
|
||||
{...bindLongPress()}
|
||||
{...(showContextMenu ? bindLongPress() : {})}
|
||||
>
|
||||
{size !== 'l' && (
|
||||
{showContextMenu && (
|
||||
<ControlledMenu
|
||||
ref={contextMenuRef}
|
||||
state={isContextMenuOpen ? 'open' : undefined}
|
||||
|
|
Loading…
Reference in a new issue