EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
text field list enter impr
Yuri Kuznetsov9e11cecfa5e5
diff --git a/client/src/views/fields/text.js b/client/src/views/fields/text.jsindex b8bbc0fa0d..4fdcf69e47 100644--- a/client/src/views/fields/text.js+++ b/client/src/views/fields/text.js@@ -617,15 +617,27 @@ class TextFieldView extends BaseFieldView {this.textAreaElement.addEventListener('keydown', this.onKeyDownMarkdownBind);}+ /**+ * @type {boolean}+ * @private+ */+ _lastEnteredKeyIsEnter = false+/*** @private* @param {KeyboardEvent} event*/onKeyDownMarkdown(event) {if (Espo.Utils.getKeyFromKeyEvent(event) !== 'Enter') {+ this._lastEnteredKeyIsEnter = false;+return;}+ const lastEnteredKeyIsEnter = this._lastEnteredKeyIsEnter;++ this._lastEnteredKeyIsEnter = true;+const target = event.target;if (!(target instanceof HTMLTextAreaElement)) {@@ -654,9 +666,7 @@ class TextFieldView extends BaseFieldView {event.preventDefault();- if (match[3].trim() === '') {- // @todo Skip handling if no enumeration line before.-+ if (match[3].trim() === '' && lastEnteredKeyIsEnter) {target.value = before.substring(0, match.index) + '\n' + after;target.selectionStart = target.selectionEnd = target.value.length - after.length;