Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix: context menu broken on linux, closes #241
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Sep 25, 2020
1 parent 0573dc7 commit 6a2ca22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { hasMemo, getRecipientAddress } from '@utils/tx-utils';

export function registerHandler(el: HTMLButtonElement | null, handler: (e: Event) => void) {
if (el === null) return;
el.addEventListener('contextmenu', handler, { passive: true });
el.addEventListener('contextmenu', handler);
}

export function deregisterHandler(el: HTMLButtonElement | null, handler: (e: Event) => void) {
Expand All @@ -28,7 +28,8 @@ interface TxListContextMenu {
};
}

export function createTxListContextMenu({ tx, copy }: TxListContextMenu) {
export function createTxListContextMenu(event: Event, { tx, copy }: TxListContextMenu) {
event.preventDefault();
const { Menu, MenuItem } = remote;
const menu = new Menu();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const TransactionListItem: FC<TransactionListItemProps> = args => {
const sumPrefix = direction === 'sent' ? '−' : '';
const memo =
tx.tx_type === 'token_transfer' &&
Buffer.from(tx.token_transfer.memo.replace('0x', '').replace(/^0+|0+$/g, ''), 'hex').toString(
Buffer.from(tx.token_transfer.memo.replace('0x', '').replace(/0+$/g, ''), 'hex').toString(
'utf8'
);
const txDate = new Date(tx.burn_block_time_iso);
Expand Down Expand Up @@ -73,7 +73,7 @@ export const TransactionListItem: FC<TransactionListItemProps> = args => {

useLayoutEffect(() => {
const el = containerRef.current;
const contextMenuHandler = () => createTxListContextMenu({ tx, copy });
const contextMenuHandler = (event: Event) => createTxListContextMenu(event, { tx, copy });
registerHandler(el, contextMenuHandler);
return () => deregisterHandler(el, contextMenuHandler);
}, [tx, copy]);
Expand Down

0 comments on commit 6a2ca22

Please sign in to comment.