mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
fix compose signature compiler
This commit is contained in:
parent
25cf891037
commit
7c25098c1b
7 changed files with 70 additions and 20 deletions
|
|
@ -594,13 +594,15 @@ PopupsComposeViewModel.prototype.onHide = function ()
|
|||
/**
|
||||
* @param {string} sSignature
|
||||
* @param {string=} sFrom
|
||||
* @param {string=} sData
|
||||
* @param {string=} sComposeType
|
||||
* @return {string}
|
||||
*/
|
||||
PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom)
|
||||
PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom, sData, sComposeType)
|
||||
{
|
||||
var bHtml = false, bData = false;
|
||||
if ('' !== sSignature)
|
||||
{
|
||||
var bHtml = false;
|
||||
if (':HTML:' === sSignature.substr(0, 6))
|
||||
{
|
||||
bHtml = true;
|
||||
|
|
@ -620,12 +622,34 @@ PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom)
|
|||
sSignature = sSignature.replace(/{{FROM}}/, '');
|
||||
sSignature = sSignature.replace(/{{DATE}}/, moment().format('llll'));
|
||||
|
||||
if (sData && Enums.ComposeType.Empty === sComposeType &&
|
||||
-1 < sSignature.indexOf('{{DATA}}'))
|
||||
{
|
||||
bData = true;
|
||||
sSignature = sSignature.replace('{{DATA}}', sData);
|
||||
}
|
||||
|
||||
sSignature = sSignature.replace(/{{DATA}}/, '');
|
||||
|
||||
if (!bHtml)
|
||||
{
|
||||
sSignature = Utils.convertPlainTextToHtml(sSignature);
|
||||
}
|
||||
}
|
||||
|
||||
if (sData && !bData)
|
||||
{
|
||||
switch (sComposeType)
|
||||
{
|
||||
case Enums.ComposeType.Empty:
|
||||
sSignature = sData + '<br />' + sSignature;
|
||||
break;
|
||||
default:
|
||||
sSignature = sSignature + '<br />' + sData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return sSignature;
|
||||
};
|
||||
|
||||
|
|
@ -839,7 +863,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
if (bSignatureToAll && '' !== sSignature &&
|
||||
Enums.ComposeType.EditAsNew !== sComposeType && Enums.ComposeType.Draft !== sComposeType)
|
||||
{
|
||||
sText = this.convertSignature(sSignature, fEmailArrayToStringLineHelper(oMessage.from, true)) + '<br />' + sText;
|
||||
sText = this.convertSignature(sSignature, fEmailArrayToStringLineHelper(oMessage.from, true), sText, sComposeType);
|
||||
}
|
||||
|
||||
this.editor(function (oEditor) {
|
||||
|
|
@ -855,9 +879,10 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
this.subject(Utils.isNormal(sCustomSubject) ? '' + sCustomSubject : '');
|
||||
|
||||
sText = Utils.isNormal(sCustomPlainText) ? '' + sCustomPlainText : '';
|
||||
if (bSignatureToAll && '' !== sSignature && '' !== sText)
|
||||
if (bSignatureToAll && '' !== sSignature)
|
||||
{
|
||||
sText = this.convertSignature(sSignature) + '<br />' + sText;
|
||||
sText = this.convertSignature(sSignature, '',
|
||||
Utils.convertPlainTextToHtml(sText), sComposeType);
|
||||
}
|
||||
|
||||
this.editor(function (oEditor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue