mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 21:57:55 +08:00
e8239a92ab
Summary: When focusing the composer, select the end of the last text block above any signatures / quoted text (which can be visible by default in Fwd:). Test Plan: Run tests Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2411
18 lines
704 B
CoffeeScript
18 lines
704 B
CoffeeScript
{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('<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
|