Mailspring/internal_packages/composer-signature/lib/signature-draft-extension.coffee
Evan Morikawa fa3a2ee631 feat(signatures): add signature support in preferences
Summary:
Adding signature support in preferences

Extracting out DraftStore extensions from the Contenteditable component

Moved Contenteditable to the nylas component kit

Build react remote window selection synchronization.

Test Plan: todo

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2204
2015-10-29 17:20:41 -04:00

14 lines
575 B
CoffeeScript

{DraftStoreExtension, AccountStore} = require 'nylas-exports'
class SignatureDraftStoreExtension extends DraftStoreExtension
@prepareNewDraft: (draft) ->
accountId = AccountStore.current().id
signature = atom.config.get("nylas.account-#{accountId}.signature")
return unless signature
insertionPoint = draft.body.indexOf('<blockquote')
if insertionPoint is -1
insertionPoint = draft.body.length
draft.body = draft.body.substr(0, insertionPoint-1) + signature + draft.body.substr(insertionPoint)
module.exports = SignatureDraftStoreExtension