Mailspring/internal_packages/message-list/lib/main.cjsx
Evan Morikawa a31c2808a9 fix(composer): make uploading attachments work
Summary:
There were several issues causing uploading to not work:

  # The file upload response came back as a string instead of an Object. Needed to detect and `JSON.parse`
  # The `MessageAttachment` component was not available as a package on the popout composer (since it used to be inside of `MessageList`)
  # The `message.draft` bit was not set properly causing the DB changes to be ignored
  # The actions notifying of `uploadStateChanged` were only being broadcasted in the main window (where the `TaskStore` is) and never making it to the popout composer.

Also keybindings for close window and up & down arrows were fixed.

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1157
2015-02-06 17:41:59 -05:00

52 lines
1.5 KiB
CoffeeScript

React = require "react"
MessageList = require "./message-list"
{ComponentRegistry} = require 'inbox-exports'
{ReplyButton,
ReplyAllButton,
ForwardButton,
ArchiveButton} = require "./core-primary-actions.cjsx"
module.exports =
item: null # The DOM item the main React component renders into
activate: (@state={}) ->
# Register components we provide globally
ComponentRegistry.register
name: 'edgehill-reply-button'
role: 'MessageListPrimaryAction'
view: ReplyButton
ComponentRegistry.register
name: 'edgehill-reply-all-button'
role: 'MessageListPrimaryAction'
view: ReplyAllButton
ComponentRegistry.register
name: 'edgehill-forward-button'
role: 'MessageListPrimaryAction'
view: ForwardButton
ComponentRegistry.register
name: 'edgehill-archive-button'
role: 'MessageListPrimaryAction'
view: ArchiveButton
unless @item
@item = document.createElement("div")
@item.setAttribute("id", "message-list")
@item.setAttribute("class", "message-list")
atom.workspace.addColumnItem(@item, "message-and-composer")
React.render(<MessageList /> , @item)
deactivate: ->
ComponentRegistry.unregister 'edgehill-reply-button'
ComponentRegistry.unregister 'edgehill-reply-all-button'
ComponentRegistry.unregister 'edgehill-forward-button'
ComponentRegistry.unregister 'edgehill-archive-button'
React.unmountComponentAtNode(@item)
@item.remove()
@item = null
serialize: -> @state