On right-click link in message bubble, show menu to copy

This commit is contained in:
Jordan Rose 2021-06-14 11:49:12 -07:00 committed by GitHub
parent df0aadc8a4
commit 9a1f722545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -351,13 +351,14 @@ export class Message extends React.Component<Props, State> {
}
};
public showMenuIfNoSelection = (
event: React.MouseEvent<HTMLDivElement>
): void => {
public showContextMenu = (event: React.MouseEvent<HTMLDivElement>): void => {
const selection = window.getSelection();
if (selection && !selection.isCollapsed) {
return;
}
if (event.target instanceof HTMLAnchorElement) {
return;
}
this.showMenu(event);
};
@ -2330,7 +2331,7 @@ export class Message extends React.Component<Props, State> {
<div
className={containerClassnames}
style={containerStyles}
onContextMenu={this.showMenuIfNoSelection}
onContextMenu={this.showContextMenu}
>
{this.renderAuthor()}
{this.renderContents()}