mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Disable context menu inside notifications popover
Popovers over popovers ain't easy
This commit is contained in:
parent
86a362c619
commit
4c7c518d4d
2 changed files with 25 additions and 15 deletions
|
@ -67,7 +67,12 @@ const contentText = {
|
||||||
|
|
||||||
const AVATARS_LIMIT = 50;
|
const AVATARS_LIMIT = 50;
|
||||||
|
|
||||||
function Notification({ notification, instance, isStatic }) {
|
function Notification({
|
||||||
|
notification,
|
||||||
|
instance,
|
||||||
|
isStatic,
|
||||||
|
disableContextMenu,
|
||||||
|
}) {
|
||||||
const { id, status, account, report, _accounts, _statuses } = notification;
|
const { id, status, account, report, _accounts, _statuses } = notification;
|
||||||
let { type } = notification;
|
let { type } = notification;
|
||||||
|
|
||||||
|
@ -300,20 +305,24 @@ function Notification({ notification, instance, isStatic }) {
|
||||||
? `/${instance}/s/${actualStatusID}`
|
? `/${instance}/s/${actualStatusID}`
|
||||||
: `/s/${actualStatusID}`
|
: `/s/${actualStatusID}`
|
||||||
}
|
}
|
||||||
onContextMenu={(e) => {
|
onContextMenu={
|
||||||
const post = e.target.querySelector('.status');
|
!disableContextMenu
|
||||||
if (post) {
|
? (e) => {
|
||||||
// Fire a custom event to open the context menu
|
const post = e.target.querySelector('.status');
|
||||||
if (e.metaKey) return;
|
if (post) {
|
||||||
e.preventDefault();
|
// Fire a custom event to open the context menu
|
||||||
post.dispatchEvent(
|
if (e.metaKey) return;
|
||||||
new MouseEvent('contextmenu', {
|
e.preventDefault();
|
||||||
clientX: e.clientX,
|
post.dispatchEvent(
|
||||||
clientY: e.clientY,
|
new MouseEvent('contextmenu', {
|
||||||
}),
|
clientX: e.clientX,
|
||||||
);
|
clientY: e.clientY,
|
||||||
}
|
}),
|
||||||
}}
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{isStatic ? (
|
{isStatic ? (
|
||||||
<Status status={actualStatus} size="s" />
|
<Status status={actualStatus} size="s" />
|
||||||
|
|
|
@ -179,6 +179,7 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
|
||||||
key={notification.id}
|
key={notification.id}
|
||||||
instance={instance}
|
instance={instance}
|
||||||
notification={notification}
|
notification={notification}
|
||||||
|
disableContextMenu
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue