mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
21a32ac57f
Summary: This diff makes a couple changes: - New drafts are no longer created in the composer component. Draft creation is back in the draft store where it belongs! - This means that the Draft List doesn't *always* contain two extra drafts, which are the unopened hot windows. - Windows never show until they're loaded, which means windows open slowly vs. opening empty. I think the former is preferable but it's easy to change. - Login window is now sized *before* it's shown instead of afterwards - The mailto: behavior is now handled by the DraftStore, which gets rid of the whole draftInitialJSON thing that never made any sense. fix(login) Make login window show at the correct size logout from edgehill completely Fix draft delete issue Don't show windows, hot or cold, until they've loaded Move logic for responding to mailto links into the draft store Always fire `windowPropsChanged` after packages load or the window is shown Show more error codes in red in activity bar Make sure DraftStoreProxy doesn't interrupt the rendering of the composer with a new draft Fix account-sidebar scroll issue, maybe? Test Plan: Run tests! Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1479
67 lines
1.8 KiB
CoffeeScript
67 lines
1.8 KiB
CoffeeScript
_ = require 'underscore-plus'
|
|
React = require 'react'
|
|
|
|
{NamespaceStore,
|
|
DatabaseStore,
|
|
Message,
|
|
ComponentRegistry,
|
|
WorkspaceStore} = require('inbox-exports')
|
|
NewComposeButton = require('./new-compose-button')
|
|
ComposerView = require('./composer-view')
|
|
|
|
module.exports =
|
|
|
|
activate: (@state={}) ->
|
|
atom.registerHotWindow
|
|
windowType: "composer"
|
|
replenishNum: 2
|
|
|
|
# Register our composer as the app-wide Composer
|
|
ComponentRegistry.register ComposerView,
|
|
role: 'Composer'
|
|
|
|
if atom.isMainWindow()
|
|
@_activateComposeButton()
|
|
else
|
|
@_setupContainer()
|
|
|
|
windowPropsReceived: ({draftLocalId, errorMessage}) ->
|
|
return unless @_container
|
|
React.render(
|
|
<ComposerView mode="fullwindow" localId={draftLocalId} />, @_container
|
|
)
|
|
if errorMessage
|
|
@_showInitialErrorDialog(errorMessage)
|
|
|
|
deactivate: ->
|
|
if atom.isMainWindow()
|
|
React.unmountComponentAtNode(@_composeButton)
|
|
@_composeButton.remove()
|
|
@_composeButton = null
|
|
else
|
|
React.unmountComponentAtNode(@_container)
|
|
@_container.remove()
|
|
@_container = null
|
|
|
|
serialize: -> @state
|
|
|
|
_setupContainer: ->
|
|
if @_container? then return # Activate once
|
|
@_container = document.createElement("div")
|
|
@_container.setAttribute("id", "composer-full-window")
|
|
@_container.setAttribute("class", "composer-full-window")
|
|
document.body.appendChild(@_container)
|
|
|
|
_activateComposeButton: ->
|
|
ComponentRegistry.register NewComposeButton,
|
|
location: WorkspaceStore.Location.RootSidebar.Toolbar
|
|
|
|
_showInitialErrorDialog: (msg) ->
|
|
remote = require('remote')
|
|
dialog = remote.require('dialog')
|
|
dialog.showMessageBox remote.getCurrentWindow(), {
|
|
type: 'warning'
|
|
buttons: ['Okay'],
|
|
message: "Error"
|
|
detail: msg
|
|
}
|