fix(menus): Customize context menu for mailto #2061

This commit is contained in:
Ben Gotow 2016-04-26 13:27:39 -07:00
parent e269dc2598
commit d64fd03c53

View file

@ -205,8 +205,12 @@ class EventedIFrame extends React.Component
linkTarget = @_getContainingTarget(event, {with: 'href'}) linkTarget = @_getContainingTarget(event, {with: 'href'})
if linkTarget if linkTarget
href = linkTarget.getAttribute('href') href = linkTarget.getAttribute('href')
menu.append(new MenuItem({ label: "Open Link", click:( -> NylasEnv.windowEventHandler.openLink({href}) )})) if href.startsWith('mailto')
menu.append(new MenuItem({ label: "Copy Link", click:( -> clipboard.writeText(href) )})) 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.append(new MenuItem({ type: 'separator' }))
# Menu actions for images # Menu actions for images