{ComposerExtension, AccountStore} = require 'nylas-exports' class SignatureComposerExtension extends ComposerExtension @prepareNewDraft: ({draft}) -> accountId = AccountStore.current().id signature = NylasEnv.config.get("nylas.account-#{accountId}.signature") return unless signature insertionPoint = draft.body.indexOf('' if insertionPoint is -1 insertionPoint = draft.body.length signatureHTML = '

' + signatureHTML draft.body = draft.body.slice(0, insertionPoint) + signatureHTML + draft.body.slice(insertionPoint) module.exports = SignatureComposerExtension