mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-26 01:53:13 +08:00
fix(attachment): fix message attachment & rename to AttachmentComponent
This commit is contained in:
parent
59b7155357
commit
9b15858bf2
5 changed files with 14 additions and 12 deletions
|
@ -90,5 +90,6 @@
|
|||
# Temporarily disabled
|
||||
"sidebar-fullcontact",
|
||||
"message-templates",
|
||||
"calendar-bar"
|
||||
"calendar-bar",
|
||||
"salesforce"
|
||||
]
|
||||
|
|
|
@ -8,8 +8,8 @@ React = require 'react'
|
|||
# @props.file is a File object
|
||||
|
||||
module.exports =
|
||||
MessageAttachment = React.createClass
|
||||
displayName: 'MessageAttachment'
|
||||
AttachmentComponent = React.createClass
|
||||
displayName: 'AttachmentComponent'
|
||||
|
||||
propTypes:
|
||||
file: React.PropTypes.object.isRequired,
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
module.exports =
|
||||
activate: (@state={}) ->
|
||||
MessageAttachment = require "./message-attachment.cjsx"
|
||||
AttachmentComponent = require "./attachment-component.cjsx"
|
||||
|
||||
ComponentRegistry.register
|
||||
name: 'MessageAttachment'
|
||||
view: MessageAttachment
|
||||
name: 'AttachmentComponent'
|
||||
view: AttachmentComponent
|
||||
role: 'Attachment'
|
||||
|
||||
deactivate: ->
|
||||
ComponentRegistry.unregister "MessageAttachment"
|
||||
ComponentRegistry.unregister "AttachmentComponent"
|
||||
|
||||
serialize: -> @state
|
||||
|
|
|
@ -35,7 +35,7 @@ ComposerView = React.createClass
|
|||
|
||||
getComponentRegistryState: ->
|
||||
ResizableComponent: ComponentRegistry.findViewByName 'ResizableComponent'
|
||||
MessageAttachment: ComponentRegistry.findViewByName 'MessageAttachment'
|
||||
AttachmentComponent: ComponentRegistry.findViewByName 'AttachmentComponent'
|
||||
FooterComponents: ComponentRegistry.findAllViewsByRole 'Composer:Footer'
|
||||
|
||||
componentWillMount: ->
|
||||
|
@ -174,9 +174,9 @@ ComposerView = React.createClass
|
|||
<Component draftLocalId={@props.localId} />
|
||||
|
||||
_fileComponents: ->
|
||||
MessageAttachment = @state.MessageAttachment
|
||||
AttachmentComponent = @state.AttachmentComponent
|
||||
(@state.files ? []).map (file) =>
|
||||
<MessageAttachment file={file}
|
||||
<AttachmentComponent file={file}
|
||||
removable={true}
|
||||
messageLocalId={@props.localId} />
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ MessageItem = React.createClass
|
|||
thread_participants: React.PropTypes.arrayOf(React.PropTypes.object),
|
||||
|
||||
mixins: [ComponentRegistry.Mixin]
|
||||
components: ['MessageAttachment']
|
||||
components: ['AttachmentComponent']
|
||||
|
||||
getInitialState: ->
|
||||
# Holds the downloadData (if any) for all of our files. It's a hash
|
||||
|
@ -102,9 +102,10 @@ MessageItem = React.createClass
|
|||
_formatContacts: (contacts=[]) ->
|
||||
|
||||
_attachmentComponents: ->
|
||||
AttachmentComponent = @state.AttachmentComponent
|
||||
attachments = _.filter @props.message.files, (f) -> not f.contentId?
|
||||
attachments.map (file) =>
|
||||
<MessageAttachment file={file} download={@state.downloads[file.id]}/>
|
||||
<AttachmentComponent file={file} download={@state.downloads[file.id]}/>
|
||||
|
||||
_messageTime: ->
|
||||
moment(@props.message.date).format(@_timeFormat())
|
||||
|
|
Loading…
Reference in a new issue