mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 09:18:51 +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 contextMenuRef = useRef();
|
||||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
||||||
const [contextMenuProps, setContextMenuProps] = useState({});
|
const [contextMenuProps, setContextMenuProps] = useState({});
|
||||||
|
|
||||||
|
const showContextMenu = !isSizeLarge && !previewMode && !_deleted && !quoted;
|
||||||
|
|
||||||
const isIOS =
|
const isIOS =
|
||||||
window.ontouchstart !== undefined &&
|
window.ontouchstart !== undefined &&
|
||||||
/iPad|iPhone|iPod/.test(navigator.userAgent);
|
/iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||||
// Only iOS/iPadOS browsers don't support contextmenu
|
// Only iOS/iPadOS browsers don't support contextmenu
|
||||||
// Some comments report iPadOS might support contextmenu if a mouse is connected
|
// Some comments report iPadOS might support contextmenu if a mouse is connected
|
||||||
const bindLongPressContext = useLongPress(
|
const bindLongPressContext = useLongPress(
|
||||||
isIOS
|
isIOS && showContextMenu
|
||||||
? (e) => {
|
? (e) => {
|
||||||
if (e.pointerType === 'mouse') return;
|
if (e.pointerType === 'mouse') return;
|
||||||
// There's 'pen' too, but not sure if contextmenu event would trigger from a pen
|
// 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 hotkeysEnabled = !readOnly && !previewMode;
|
||||||
const rRef = useHotkeys('r', replyStatus, {
|
const rRef = useHotkeys('r', replyStatus, {
|
||||||
enabled: hotkeysEnabled,
|
enabled: hotkeysEnabled,
|
||||||
|
|
Loading…
Reference in a new issue