 
 RouterMixin      = require '../mixins/router_mixin'
 LinkedStateMixin = require 'react-addons-linked-state-mixin'
-
 
 # Component that allows the user to write emails.
 module.exports = Compose = React.createClass

            editor.removeEventListener 'click', @saveFocus

    closeSaveDraft: ->
        fetch = =>
            # reload conversation to update its length
            if (cid = @state.conversationID)
                MessageActionCreator.fetchConversation cid

        save = =>
            MessageActionCreator.send _.clone(@state), (error, message) ->
                if error? or not message?
                    msg = "#{t "message action draft ko"} #{error}"
                    LayoutActionCreator.alertError msg
                    return

                fetch()

        # Fetch
        unless @hasChanged()
            fetch()
            return

        # Do not ask for save
        save()
        return

    render: ->
        closeUrl = @buildClosePanelUrl @props.layout


        _message = _.clone @state
        @state.isSaving = true
        console.log 'SAVE', _message.html
        MessageActionCreator.send _message, (error, message) =>
            delete @state.isSaving
            if error? or not message?
