mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
15 lines
570 B
CoffeeScript
15 lines
570 B
CoffeeScript
|
{DraftStoreExtension, NamespaceStore} = require 'nylas-exports'
|
||
|
|
||
|
class SignatureDraftStoreExtension extends DraftStoreExtension
|
||
|
@prepareNewDraft: (draft) ->
|
||
|
namespaceId = NamespaceStore.current().id
|
||
|
signature = atom.config.get("signatures.#{namespaceId}")
|
||
|
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
|