mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-13 11:38:31 +08:00
feat(msg-list): Don't make participants mailto links, add context menu
This commit is contained in:
parent
657b8f38ef
commit
5f8bb9dffd
3 changed files with 42 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
|||
_ = require 'underscore'
|
||||
React = require "react"
|
||||
classnames = require 'classnames'
|
||||
{Contact} = require 'nylas-exports'
|
||||
{Actions, Contact} = require 'nylas-exports'
|
||||
{Menu, MenuItem} = require('electron').remote
|
||||
|
||||
|
||||
MAX_COLLAPSED = 5
|
||||
|
@ -47,6 +48,15 @@ class MessageParticipants extends React.Component
|
|||
names.push("and #{extra} more")
|
||||
names.join(", ")
|
||||
|
||||
_onContactContextMenu: (contact) =>
|
||||
menu = new Menu()
|
||||
menu.append(new MenuItem({role: 'copy'}))
|
||||
menu.append(new MenuItem({
|
||||
label: "Email #{contact.email}",
|
||||
click: => Actions.composeNewDraftToRecipient(contact)
|
||||
}))
|
||||
menu.popup(NylasEnv.getCurrentWindow())
|
||||
|
||||
# Renderers
|
||||
|
||||
_renderFullContacts: (contacts = []) =>
|
||||
|
@ -61,13 +71,26 @@ class MessageParticipants extends React.Component
|
|||
{c.fullName()}
|
||||
</div>
|
||||
<div className="participant-secondary">
|
||||
{"<"}<span onClick={@_selectText}><a href="mailto:#{c.email}">{c.email}</a></span>{">#{comma}"}
|
||||
{"<"}
|
||||
<span
|
||||
onClick={@_selectText}
|
||||
onContextMenu={=> @_onContactContextMenu(c)}
|
||||
>
|
||||
{c.email}
|
||||
</span>
|
||||
{">#{comma}"}
|
||||
</div>
|
||||
</div>
|
||||
else
|
||||
<div key={"#{c.email}-#{i}"} className="participant selectable">
|
||||
<div className="participant-primary">
|
||||
<span onClick={@_selectText}><a href="mailto:#{c.email}">{c.email}</a></span>{comma}
|
||||
<span
|
||||
onClick={@_selectText}
|
||||
onContextMenu={=> @_onContactContextMenu(c)}
|
||||
>
|
||||
{c.email}
|
||||
</span>
|
||||
{comma}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -360,6 +360,17 @@ class Actions
|
|||
###
|
||||
@composeNewBlankDraft: ActionScopeWindow
|
||||
|
||||
###
|
||||
Public: Open a new composer window for a new draft addressed to the given recipient
|
||||
|
||||
*Scope: Window*
|
||||
|
||||
```
|
||||
Actions.composeNewDraftToRecipient(contact)
|
||||
```
|
||||
###
|
||||
@composeNewDraftToRecipient: ActionScopeWindow
|
||||
|
||||
###
|
||||
Public: Send the draft with the given ID. This Action is handled by the {DraftStore},
|
||||
which finalizes the {DraftChangeSet} and allows {ComposerExtension}s to display
|
||||
|
|
|
@ -54,6 +54,7 @@ class DraftStore
|
|||
@listenTo Actions.composeForward, @_onComposeForward
|
||||
@listenTo Actions.composePopoutDraft, @_onPopoutDraftClientId
|
||||
@listenTo Actions.composeNewBlankDraft, @_onPopoutBlankDraft
|
||||
@listenTo Actions.composeNewDraftToRecipient, @_onPopoutNewDraftToRecipient
|
||||
@listenTo Actions.sendDraftFailed, @_onSendDraftFailed
|
||||
@listenTo Actions.sendDraftSuccess, @_onSendDraftSuccess
|
||||
@listenTo Actions.sendQuickReply, @_onSendQuickReply
|
||||
|
@ -266,6 +267,10 @@ class DraftStore
|
|||
_createSession: (clientId, draft) =>
|
||||
@_draftSessions[clientId] = new DraftEditingSession(clientId, draft)
|
||||
|
||||
_onPopoutNewDraftToRecipient: (contact) =>
|
||||
DraftFactory.createDraft({to: [contact]}).then (draft) =>
|
||||
@_finalizeAndPersistNewMessage(draft, popout: true)
|
||||
|
||||
_onPopoutBlankDraft: =>
|
||||
Actions.recordUserEvent("Draft Created", {type: "new"})
|
||||
NylasEnv.perf.start("Popout Draft")
|
||||
|
|
Loading…
Reference in a new issue