mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
e83bf2bbec
Summary: - New behavior is that the in split mode, you will perform actions on the selection via the MessageListToolbar (the toolbar positioned above the message list) - Refactored and moved around a bunch of code to achieve this: - Mostly renaming stuff and moving stuff around and removing some duplication - Update naming of toolbar role to a single role, and update relevant code - Converted and refactored a bunch of code into ES6, specifically to reuse the code for the ThreadActionsToolbar at the 2 locations - Deprecated MultiselectActionBar in favor of MultiselectToolbar - Deprecated old roles - Punted the animation for the stackable cards in the selection display for now. - #370 Test Plan: - Manual and unit tests Reviewers: evan, drew, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2756
62 lines
1.7 KiB
CoffeeScript
62 lines
1.7 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{Actions} = require 'nylas-exports'
|
|
{InjectedComponentSet, ListTabular} = require 'nylas-component-kit'
|
|
|
|
|
|
snippet = (html) =>
|
|
return "" unless html and typeof(html) is 'string'
|
|
try
|
|
@draftSanitizer ?= document.createElement('div')
|
|
@draftSanitizer.innerHTML = html[0..400]
|
|
text = @draftSanitizer.innerText
|
|
text[0..200]
|
|
catch
|
|
return ""
|
|
|
|
subject = (subj) ->
|
|
if (subj ? "").trim().length is 0
|
|
return <span className="no-subject">(No Subject)</span>
|
|
else
|
|
return subj
|
|
|
|
ParticipantsColumn = new ListTabular.Column
|
|
name: "Participants"
|
|
width: 200
|
|
resolver: (draft) =>
|
|
list = [].concat(draft.to, draft.cc, draft.bcc)
|
|
|
|
if list.length > 0
|
|
<div className="participants">
|
|
<span>{list.map((p) => p.displayName()).join(', ')}</span>
|
|
</div>
|
|
else
|
|
<div className="participants no-recipients">
|
|
(No Recipients)
|
|
</div>
|
|
|
|
ContentsColumn = new ListTabular.Column
|
|
name: "Contents"
|
|
flex: 4
|
|
resolver: (draft) =>
|
|
attachments = []
|
|
if draft.files?.length > 0
|
|
attachments = <div className="thread-icon thread-icon-attachment"></div>
|
|
<span className="details">
|
|
<span className="subject">{subject(draft.subject)}</span>
|
|
<span className="snippet">{snippet(draft.body)}</span>
|
|
{attachments}
|
|
</span>
|
|
|
|
StatusColumn = new ListTabular.Column
|
|
name: "State"
|
|
resolver: (draft) =>
|
|
<InjectedComponentSet
|
|
inline={true}
|
|
containersRequired={false}
|
|
matching={role: "DraftList:DraftStatus"}
|
|
className="draft-list-injected-state"
|
|
exposedProps={{draft}}/>
|
|
|
|
module.exports =
|
|
Wide: [ParticipantsColumn, ContentsColumn, StatusColumn]
|