mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-13 10:26:15 +00:00
committed by
Akash Nimare
parent
01926e1234
commit
bda0dd29df
@@ -5,6 +5,7 @@ const {clipboard, Menu} = remote;
|
|||||||
export const contextMenu = (webContents: Electron.WebContents, event: Event, props: ContextMenuParams) => {
|
export const contextMenu = (webContents: Electron.WebContents, event: Event, props: ContextMenuParams) => {
|
||||||
const isText = Boolean(props.selectionText.length);
|
const isText = Boolean(props.selectionText.length);
|
||||||
const isLink = Boolean(props.linkURL);
|
const isLink = Boolean(props.linkURL);
|
||||||
|
const isEmailAddress = Boolean(props.linkURL.startsWith('mailto:'));
|
||||||
|
|
||||||
const makeSuggestion = (suggestion: string) => ({
|
const makeSuggestion = (suggestion: string) => ({
|
||||||
label: suggestion,
|
label: suggestion,
|
||||||
@@ -55,12 +56,12 @@ export const contextMenu = (webContents: Electron.WebContents, event: Event, pro
|
|||||||
}, {
|
}, {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
}, {
|
}, {
|
||||||
label: t.__('Copy Link'),
|
label: isEmailAddress ? t.__('Copy Email Address') : t.__('Copy Link'),
|
||||||
visible: isText && isLink,
|
visible: isLink,
|
||||||
click(_item) {
|
click(_item) {
|
||||||
clipboard.write({
|
clipboard.write({
|
||||||
bookmark: props.linkText,
|
bookmark: props.linkText,
|
||||||
text: props.linkURL
|
text: isEmailAddress ? props.linkText : props.linkURL
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Reference in New Issue
Block a user