Skip to content

Commit

Permalink
prevent msg ctx menu from open on text selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura committed Oct 17, 2023
1 parent e20e67a commit edd390f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/organisms/room/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ export const Message = as<'div', MessageProps>(
const hideOptions = () => setHover(false);

const handleContextMenu: MouseEventHandler<HTMLDivElement> = (evt) => {
if (evt.altKey) return;
if (evt.altKey || !window.getSelection()?.isCollapsed) return;
const tag = (evt.target as any).tagName;
if (typeof tag === 'string' && tag.toLowerCase() === 'a') return;
evt.preventDefault();
Expand Down Expand Up @@ -965,7 +965,7 @@ export const Event = as<'div', EventProps>(
const hideOptions = () => setHover(false);

const handleContextMenu: MouseEventHandler<HTMLDivElement> = (evt) => {
if (evt.altKey) return;
if (evt.altKey || !window.getSelection()?.isCollapsed) return;
const tag = (evt.target as any).tagName;
if (typeof tag === 'string' && tag.toLowerCase() === 'a') return;
evt.preventDefault();
Expand Down

0 comments on commit edd390f

Please sign in to comment.