Mailspring/internal_packages/composer-signature/lib/signature-composer-extension.coffee
Juan Tejada 9f998d1964 refactor(rip-current-account): Rips out AccountStore.current
Summary:
- WIP: Need to fix tests and some errors!
- Refactors Category class to hold information about its type
- Refactors CategoryStore to rely on observables instead of local caches
- Adds and updates Observables and helpers
- Refactors ContactStore to hold entire cache of contacts instead of per
  current account
  - Same for ContactRankingStore and other stores
- Refactors method names for AccountStore + some helpers
- Updates MailViewFilter to hold an account
  - Adds basic Unified filter
- Replaces AccountStore.current calls with either:
  - The account of the currently focused MailViewFilter
  - The account associated with a thread, message, file, etc...
  - A parameter to be passed in
  - Arbitrarily, the first account in the AccountsStore

Test Plan: - Unit tests

Reviewers: evan, bengotow

Differential Revision: https://phab.nylas.com/D2423
2016-01-08 14:22:13 -08:00

19 lines
694 B
CoffeeScript

{ComposerExtension, AccountStore} = require 'nylas-exports'
class SignatureComposerExtension extends ComposerExtension
@prepareNewDraft: ({draft}) ->
accountId = draft.accountId
signature = NylasEnv.config.get("nylas.account-#{accountId}.signature")
return unless signature
insertionPoint = draft.body.indexOf('<blockquote')
signatureHTML = '<div class="nylas-n1-signature">' + signature + '</div>'
if insertionPoint is -1
insertionPoint = draft.body.length
signatureHTML = '<br/><br/>' + signatureHTML
draft.body = draft.body.slice(0, insertionPoint) + signatureHTML + draft.body.slice(insertionPoint)
module.exports = SignatureComposerExtension