mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Add more conditions for binding longpress
Should be same condition as contextmenu
This commit is contained in:
parent
030728bc93
commit
bf7acb6eab
1 changed files with 4 additions and 3 deletions
|
@ -795,13 +795,16 @@ function Status({
|
|||
const contextMenuRef = useRef();
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
||||
const [contextMenuProps, setContextMenuProps] = useState({});
|
||||
|
||||
const showContextMenu = !isSizeLarge && !previewMode && !_deleted && !quoted;
|
||||
|
||||
const isIOS =
|
||||
window.ontouchstart !== undefined &&
|
||||
/iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||
// Only iOS/iPadOS browsers don't support contextmenu
|
||||
// Some comments report iPadOS might support contextmenu if a mouse is connected
|
||||
const bindLongPressContext = useLongPress(
|
||||
isIOS
|
||||
isIOS && showContextMenu
|
||||
? (e) => {
|
||||
if (e.pointerType === 'mouse') return;
|
||||
// There's 'pen' too, but not sure if contextmenu event would trigger from a pen
|
||||
|
@ -829,8 +832,6 @@ function Status({
|
|||
},
|
||||
);
|
||||
|
||||
const showContextMenu = size !== 'l' && !previewMode && !_deleted && !quoted;
|
||||
|
||||
const hotkeysEnabled = !readOnly && !previewMode;
|
||||
const rRef = useHotkeys('r', replyStatus, {
|
||||
enabled: hotkeysEnabled,
|
||||
|
|
Loading…
Reference in a new issue