mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-13 19:49:40 +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'
|
_ = require 'underscore'
|
||||||
React = require "react"
|
React = require "react"
|
||||||
classnames = require 'classnames'
|
classnames = require 'classnames'
|
||||||
{Contact} = require 'nylas-exports'
|
{Actions, Contact} = require 'nylas-exports'
|
||||||
|
{Menu, MenuItem} = require('electron').remote
|
||||||
|
|
||||||
|
|
||||||
MAX_COLLAPSED = 5
|
MAX_COLLAPSED = 5
|
||||||
|
@ -47,6 +48,15 @@ class MessageParticipants extends React.Component
|
||||||
names.push("and #{extra} more")
|
names.push("and #{extra} more")
|
||||||
names.join(", ")
|
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
|
# Renderers
|
||||||
|
|
||||||
_renderFullContacts: (contacts = []) =>
|
_renderFullContacts: (contacts = []) =>
|
||||||
|
@ -61,13 +71,26 @@ class MessageParticipants extends React.Component
|
||||||
{c.fullName()}
|
{c.fullName()}
|
||||||
</div>
|
</div>
|
||||||
<div className="participant-secondary">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
else
|
else
|
||||||
<div key={"#{c.email}-#{i}"} className="participant selectable">
|
<div key={"#{c.email}-#{i}"} className="participant selectable">
|
||||||
<div className="participant-primary">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -360,6 +360,17 @@ class Actions
|
||||||
###
|
###
|
||||||
@composeNewBlankDraft: ActionScopeWindow
|
@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},
|
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
|
which finalizes the {DraftChangeSet} and allows {ComposerExtension}s to display
|
||||||
|
|
|
@ -54,6 +54,7 @@ class DraftStore
|
||||||
@listenTo Actions.composeForward, @_onComposeForward
|
@listenTo Actions.composeForward, @_onComposeForward
|
||||||
@listenTo Actions.composePopoutDraft, @_onPopoutDraftClientId
|
@listenTo Actions.composePopoutDraft, @_onPopoutDraftClientId
|
||||||
@listenTo Actions.composeNewBlankDraft, @_onPopoutBlankDraft
|
@listenTo Actions.composeNewBlankDraft, @_onPopoutBlankDraft
|
||||||
|
@listenTo Actions.composeNewDraftToRecipient, @_onPopoutNewDraftToRecipient
|
||||||
@listenTo Actions.sendDraftFailed, @_onSendDraftFailed
|
@listenTo Actions.sendDraftFailed, @_onSendDraftFailed
|
||||||
@listenTo Actions.sendDraftSuccess, @_onSendDraftSuccess
|
@listenTo Actions.sendDraftSuccess, @_onSendDraftSuccess
|
||||||
@listenTo Actions.sendQuickReply, @_onSendQuickReply
|
@listenTo Actions.sendQuickReply, @_onSendQuickReply
|
||||||
|
@ -266,6 +267,10 @@ class DraftStore
|
||||||
_createSession: (clientId, draft) =>
|
_createSession: (clientId, draft) =>
|
||||||
@_draftSessions[clientId] = new DraftEditingSession(clientId, draft)
|
@_draftSessions[clientId] = new DraftEditingSession(clientId, draft)
|
||||||
|
|
||||||
|
_onPopoutNewDraftToRecipient: (contact) =>
|
||||||
|
DraftFactory.createDraft({to: [contact]}).then (draft) =>
|
||||||
|
@_finalizeAndPersistNewMessage(draft, popout: true)
|
||||||
|
|
||||||
_onPopoutBlankDraft: =>
|
_onPopoutBlankDraft: =>
|
||||||
Actions.recordUserEvent("Draft Created", {type: "new"})
|
Actions.recordUserEvent("Draft Created", {type: "new"})
|
||||||
NylasEnv.perf.start("Popout Draft")
|
NylasEnv.perf.start("Popout Draft")
|
||||||
|
|
Loading…
Reference in a new issue