mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-30 19:43:39 +00:00
context-menu: Copy the email address, not the link text.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -3,9 +3,10 @@ import * as t from '../utils/translation-util';
|
||||
const {clipboard, Menu} = remote;
|
||||
|
||||
export const contextMenu = (webContents: Electron.WebContents, event: Event, props: ContextMenuParams) => {
|
||||
const isText = Boolean(props.selectionText.length);
|
||||
const isLink = Boolean(props.linkURL);
|
||||
const isEmailAddress = Boolean(props.linkURL.startsWith('mailto:'));
|
||||
const isText = props.selectionText !== '';
|
||||
const isLink = props.linkURL !== '';
|
||||
const linkURL = isLink ? new URL(props.linkURL) : undefined;
|
||||
const isEmailAddress = isLink ? linkURL.protocol === 'mailto:' : undefined;
|
||||
|
||||
const makeSuggestion = (suggestion: string) => ({
|
||||
label: suggestion,
|
||||
@@ -63,7 +64,7 @@ export const contextMenu = (webContents: Electron.WebContents, event: Event, pro
|
||||
click(_item) {
|
||||
clipboard.write({
|
||||
bookmark: props.linkText,
|
||||
text: isEmailAddress ? props.linkText : props.linkURL
|
||||
text: isEmailAddress ? linkURL.pathname : props.linkURL
|
||||
});
|
||||
}
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user