EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
compose initial fields ref
Yuri Kuznetsov8f054a475ce3
diff --git a/client/src/views/email/record/compose.js b/client/src/views/email/record/compose.jsindex 3789fc46f0..16e7fbdbfe 100644--- a/client/src/views/email/record/compose.js+++ b/client/src/views/email/record/compose.js@@ -36,23 +36,31 @@ class EmailComposeRecordView extends EditRecordView {isWide = truesideView = false- setupBeforeFinal() {- super.setupBeforeFinal();-- this.initialBody = null;- this.initialIsHtml = null;+ /**+ * @private+ * @type {string|null}+ */+ initialBody- if (!this.model.get('isHtml') && this.getPreferences().get('emailReplyForceHtml')) {- const body = (this.model.get('body') || '').replace(/\n/g, '<br>');+ /**+ * @private+ * @type {boolean|null}+ */+ initialIsHtml- this.model.set('body', body, {silent: true});- this.model.set('isHtml', true, {silent: true});+ setupBeforeFinal() {+ this.initialBody = this.model.attributes.body;+ this.initialIsHtml = this.model.attributes.isHtml;++ if (+ !this.model.attributes.isHtml &&+ this.getPreferences().get('emailReplyForceHtml')+ ) {+ this.initialBody = (this.initialBody || '').replace(/\n/g, '<br>') || null;+ this.initialIsHtml = true;}- if (this.model.get('body')) {- this.initialBody = this.model.get('body');- this.initialIsHtml = this.model.get('isHtml');- }+ let body = this.initialBody;if (!this.options.signatureDisabled && this.hasSignature()) {let addSignatureMethod = 'prependSignature';@@ -61,10 +69,13 @@ class EmailComposeRecordView extends EditRecordView {addSignatureMethod = 'appendSignature';}- const body = this[addSignatureMethod](this.model.get('body') || '', this.model.get('isHtml'));-- this.model.set('body', body, {silent: true});+ body = this[addSignatureMethod](body || '', this.initialIsHtml) || null;}++ this.model.set('body', body, {silent: true});+ this.model.set('isHtml', this.initialIsHtml, {silent: true});++ super.setupBeforeFinal();}setup() {