diff --git a/dev/Common/HtmlEditor.js b/dev/Common/HtmlEditor.js
index 136217bdb..e0b4c8593 100644
--- a/dev/Common/HtmlEditor.js
+++ b/dev/Common/HtmlEditor.js
@@ -140,7 +140,10 @@
if (this.editor)
{
this.modeToggle(true);
- this.editor.setData(sHtml);
+
+ try {
+ this.editor.setData(sHtml);
+ } catch (e) {}
if (bFocus)
{
@@ -160,7 +163,9 @@
}
else
{
- this.editor.setData(sPlain);
+ try {
+ this.editor.setData(sPlain);
+ } catch (e) {}
}
if (bFocus)
@@ -273,7 +278,9 @@
{
if (this.editor)
{
- this.editor.focus();
+ try {
+ this.editor.focus();
+ } catch (e) {}
}
};
diff --git a/dev/Settings/User/Identities.js b/dev/Settings/User/Identities.js
index bec5d34be..daeba7009 100644
--- a/dev/Settings/User/Identities.js
+++ b/dev/Settings/User/Identities.js
@@ -30,7 +30,6 @@
this.displayName = AccountStore.displayName;
this.signature = AccountStore.signature;
- this.signatureToAll = AccountStore.signatureToAll;
this.replyTo = AccountStore.replyTo;
this.signatureDom = ko.observable(null);
@@ -219,12 +218,6 @@
});
});
- AccountStore.signatureToAll.subscribe(function (bValue) {
- Remote.saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
}, 50);
};
diff --git a/dev/Settings/User/Identity.js b/dev/Settings/User/Identity.js
index 923a1c034..873ee33fe 100644
--- a/dev/Settings/User/Identity.js
+++ b/dev/Settings/User/Identity.js
@@ -25,7 +25,6 @@
this.displayName = AccountStore.displayName;
this.signature = AccountStore.signature;
- this.signatureToAll = AccountStore.signatureToAll;
this.replyTo = AccountStore.replyTo;
this.signatureDom = ko.observable(null);
@@ -90,12 +89,6 @@
});
});
- AccountStore.signatureToAll.subscribe(function (bValue) {
- Remote.saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
}, 50);
};
diff --git a/dev/Stores/User/Account.js b/dev/Stores/User/Account.js
index 1bc763522..b389c3b6b 100644
--- a/dev/Stores/User/Account.js
+++ b/dev/Stores/User/Account.js
@@ -24,7 +24,6 @@
this.displayName = ko.observable('');
this.replyTo = ko.observable('');
this.signature = ko.observable('');
- this.signatureToAll = ko.observable(false);
this.accounts = ko.observableArray([]);
this.accounts.loading = ko.observable(false).extend({'throttle': 100});
@@ -74,7 +73,6 @@
this.displayName(Settings.settingsGet('DisplayName'));
this.replyTo(Settings.settingsGet('ReplyTo'));
this.signature(Settings.settingsGet('Signature'));
- this.signatureToAll(!!Settings.settingsGet('SignatureToAll'));
};
module.exports = new AccountUserStore();
diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js
index 57f2bcda3..b0ca01f46 100644
--- a/dev/View/Popup/Compose.js
+++ b/dev/View/Popup/Compose.js
@@ -758,13 +758,13 @@
};
/**
+ * @param {string} sInputText
* @param {string} sSignature
* @param {string=} sFrom
- * @param {string=} sData
* @param {string=} sComposeType
* @return {string}
*/
- ComposePopupView.prototype.convertSignature = function (sSignature, sFrom, sData, sComposeType)
+ ComposePopupView.prototype.convertSignature = function (sInputText, sSignature, sFrom, sComposeType)
{
var bHtml = false, bData = false;
if ('' !== sSignature)
@@ -801,35 +801,51 @@
sSignature = sSignature.replace(/{{DATE}}/g, moment().format('llll'));
}
- if (sData && Enums.ComposeType.Empty === sComposeType &&
- -1 < sSignature.indexOf('{{BODY}}'))
+ // Enums.ComposeType.Empty === sComposeType
+ if (-1 < sSignature.indexOf('{{BODY}}'))
{
- bData = true;
- sSignature = sSignature.replace('{{BODY}}', sData);
+ if (sInputText)
+ {
+ bData = true;
+
+ sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true);
+ sSignature = sSignature.replace('{{BODY}}', sInputText);
+ }
+ else
+ {
+ sSignature = sSignature.replace(/[\n]?{{BODY}}[\n]?/g, '{{BODY}}');
+ sSignature = sSignature.replace(/{{BODY}}/g, '');
+
+ sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true);
+ }
}
-
- sSignature = sSignature.replace(/{{BODY}}/g, '');
-
- if (!bHtml)
+ else
{
- sSignature = Utils.plainToHtml(sSignature, true);
+ sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true);
}
}
- if (sData && !bData)
+ if (!bData)
{
- switch (sComposeType)
+ if (sSignature)
{
- case Enums.ComposeType.Empty:
- sSignature = sData + '
' + sSignature;
- break;
- default:
- sSignature = sSignature + '
' + sData;
- break;
+ switch (sComposeType)
+ {
+ case Enums.ComposeType.Empty:
+ sInputText = sInputText + '
' + sSignature;
+ break;
+ default:
+ sInputText = sSignature + '
' + sInputText;
+ break;
+ }
}
}
+ else
+ {
+ sInputText = sSignature;
+ }
- return sSignature;
+ return sInputText;
};
ComposePopupView.prototype.editor = function (fOnInit)
@@ -951,7 +967,6 @@
oIdResult = null,
mEmail = AccountStore.email(),
sSignature = AccountStore.signature(),
- bSignatureToAll = AccountStore.signatureToAll(),
aDownloads = [],
aDraftInfo = null,
oMessage = null,
@@ -1134,10 +1149,10 @@
break;
}
- if (bSignatureToAll && '' !== sSignature &&
+ if ('' !== sSignature &&
Enums.ComposeType.EditAsNew !== sComposeType && Enums.ComposeType.Draft !== sComposeType)
{
- sText = this.convertSignature(sSignature, fEmailArrayToStringLineHelper(oMessage.from, true), sText, sComposeType);
+ sText = this.convertSignature(sText, sSignature, fEmailArrayToStringLineHelper(oMessage.from, true), sComposeType);
}
this.editor(function (oEditor) {
@@ -1154,10 +1169,9 @@
this.subject(Utils.isNormal(sCustomSubject) ? '' + sCustomSubject : '');
sText = Utils.isNormal(sCustomPlainText) ? '' + sCustomPlainText : '';
- if (bSignatureToAll && '' !== sSignature)
+ if ('' !== sSignature)
{
- sText = this.convertSignature(sSignature, '',
- Utils.plainToHtml(sText, true), sComposeType);
+ sText = this.convertSignature(Utils.plainToHtml(sText, true), sSignature, '', sComposeType);
}
this.editor(function (oEditor) {
diff --git a/package.json b/package.json
index 4f8dfb5d8..e65fe165d 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.8.0",
- "release": "250",
+ "release": "251",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "gulpfile.js",
diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php
index db5ce44c1..e81914baa 100644
--- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php
+++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php
@@ -1451,7 +1451,6 @@ class Actions
$aResult['DisplayName'] = '';
$aResult['ReplyTo'] = '';
$aResult['Signature'] = '';
- $aResult['SignatureToAll'] = false;
$aResult['EnableTwoFactor'] = false;
$aResult['ParentEmail'] = '';
$aResult['InterfaceAnimation'] = true;
@@ -1497,7 +1496,6 @@ class Actions
$aResult['DisplayName'] = $oSettings->GetConf('DisplayName', $aResult['DisplayName']);
$aResult['ReplyTo'] = $oSettings->GetConf('ReplyTo', $aResult['ReplyTo']);
$aResult['Signature'] = $oSettings->GetConf('Signature', $aResult['Signature']);
- $aResult['SignatureToAll'] = !!$oSettings->GetConf('SignatureToAll', $aResult['SignatureToAll']);
$aResult['EnableTwoFactor'] = !!$oSettings->GetConf('EnableTwoFactor', $aResult['EnableTwoFactor']);
$aResult['ParentEmail'] = $oAccount->ParentEmail();
@@ -4363,7 +4361,6 @@ class Actions
$this->setSettingsFromParams($oSettings, 'DisplayName', 'string');
$this->setSettingsFromParams($oSettings, 'ReplyTo', 'string');
$this->setSettingsFromParams($oSettings, 'Signature', 'string');
- $this->setSettingsFromParams($oSettings, 'SignatureToAll', 'bool');
$this->setSettingsFromParams($oSettings, 'EnableTwoFactor', 'bool');
return $this->DefaultResponse(__FUNCTION__,
diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SettingsIdentities.html b/rainloop/v/0.0.0/app/templates/Views/User/SettingsIdentities.html
index 0904ffa47..e15221f06 100644
--- a/rainloop/v/0.0.0/app/templates/Views/User/SettingsIdentities.html
+++ b/rainloop/v/0.0.0/app/templates/Views/User/SettingsIdentities.html
@@ -62,17 +62,6 @@
}">
-