mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-02 13:03:22 +00:00
context-menu: Fix strictNullChecks violations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -13,7 +13,6 @@ export const contextMenu = (
|
||||
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,
|
||||
@@ -77,12 +76,16 @@ export const contextMenu = (
|
||||
type: "separator",
|
||||
},
|
||||
{
|
||||
label: isEmailAddress ? t.__("Copy Email Address") : t.__("Copy Link"),
|
||||
label:
|
||||
linkURL?.protocol === "mailto:"
|
||||
? t.__("Copy Email Address")
|
||||
: t.__("Copy Link"),
|
||||
visible: isLink,
|
||||
click(_item) {
|
||||
clipboard.write({
|
||||
bookmark: props.linkText,
|
||||
text: isEmailAddress ? linkURL.pathname : props.linkURL,
|
||||
text:
|
||||
linkURL?.protocol === "mailto:" ? linkURL.pathname : props.linkURL,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user