From d64fd03c539a76d31a8d45951a6cbaa86342ca40 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 26 Apr 2016 13:27:39 -0700 Subject: [PATCH] fix(menus): Customize context menu for mailto #2061 --- src/components/evented-iframe.cjsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/evented-iframe.cjsx b/src/components/evented-iframe.cjsx index 1a4aaf786..27ac65740 100644 --- a/src/components/evented-iframe.cjsx +++ b/src/components/evented-iframe.cjsx @@ -205,8 +205,12 @@ class EventedIFrame extends React.Component linkTarget = @_getContainingTarget(event, {with: 'href'}) if linkTarget href = linkTarget.getAttribute('href') - menu.append(new MenuItem({ label: "Open Link", click:( -> NylasEnv.windowEventHandler.openLink({href}) )})) - menu.append(new MenuItem({ label: "Copy Link", click:( -> clipboard.writeText(href) )})) + if href.startsWith('mailto') + menu.append(new MenuItem({ label: "Compose Message...", click:( -> NylasEnv.windowEventHandler.openLink({href}) )})) + menu.append(new MenuItem({ label: "Copy Email Address", click:( -> clipboard.writeText(href.split('mailto:').pop()) )})) + else + menu.append(new MenuItem({ label: "Open Link", click:( -> NylasEnv.windowEventHandler.openLink({href}) )})) + menu.append(new MenuItem({ label: "Copy Link", click:( -> clipboard.writeText(href) )})) menu.append(new MenuItem({ type: 'separator' })) # Menu actions for images