no keyCode usage
This commit is contained in:
@@ -103,7 +103,7 @@ define('ui/multi-select', ['lib!Selectize'], (Selectize) => {
|
||||
selectizeOptions.persist = false;
|
||||
selectizeOptions.create = options.create;
|
||||
selectizeOptions.render = {
|
||||
option_create: (data, escape) => {
|
||||
option_create: data => {
|
||||
return $('<div>')
|
||||
.addClass('create')
|
||||
.append(
|
||||
@@ -197,7 +197,7 @@ define('ui/multi-select', ['lib!Selectize'], (Selectize) => {
|
||||
let index, option;
|
||||
|
||||
if (
|
||||
e.keyCode === 8 &&
|
||||
e.code === 'Backspace' &&
|
||||
this.$control_input.val() === '' &&
|
||||
!this.$activeItems.length
|
||||
) {
|
||||
|
||||
@@ -26,10 +26,9 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define(
|
||||
'views/email/fields/email-address-varchar',
|
||||
['views/fields/base', 'views/email/fields/from-address-varchar', 'views/email/fields/email-address'],
|
||||
function (Dep, From, EmailAddress) {
|
||||
define('views/email/fields/email-address-varchar',
|
||||
['views/fields/base', 'views/email/fields/from-address-varchar', 'views/email/fields/email-address'],
|
||||
function (Dep, From, EmailAddress) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -40,7 +39,7 @@ define(
|
||||
emailAddressRegExp: /[-!#$%&'*+/=?^_`{|}~A-Za-z0-9]+(?:\.[-!#$%&'*+/=?^_`{|}~A-Za-z0-9]+)*@([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]/gi,
|
||||
|
||||
data: function () {
|
||||
var data = Dep.prototype.data.call(this);
|
||||
let data = Dep.prototype.data.call(this);
|
||||
|
||||
data.valueIsSet = this.model.has(this.name);
|
||||
|
||||
@@ -49,59 +48,73 @@ define(
|
||||
|
||||
events: {
|
||||
'click a[data-action="clearAddress"]': function (e) {
|
||||
var address = $(e.currentTarget).data('address').toString();
|
||||
let address = $(e.currentTarget).data('address').toString();
|
||||
|
||||
this.deleteAddress(address);
|
||||
},
|
||||
'keyup input': function (e) {
|
||||
if (this.mode === 'search') {
|
||||
if (!this.isEditMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.keyCode === 188 || e.keyCode === 186 || e.keyCode === 13) {
|
||||
var $input = $(e.currentTarget);
|
||||
var address = $input.val().replace(',', '').replace(';', '').trim();
|
||||
let key = Espo.Utils.getKeyFromKeyEvent(e);
|
||||
|
||||
if (~address.indexOf('@')) {
|
||||
if (this.checkEmailAddressInString(address)) {
|
||||
this.addAddress(address, '');
|
||||
$input.val('');
|
||||
}
|
||||
if (
|
||||
key === 'Comma' ||
|
||||
key === 'Semicolon' ||
|
||||
key === 'Enter'
|
||||
) {
|
||||
let $input = $(e.currentTarget);
|
||||
let address = $input.val().replace(',', '').replace(';', '').trim();
|
||||
|
||||
if (address.indexOf('@') === -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
'change input': function (e) {
|
||||
if (this.mode === 'search') {
|
||||
return;
|
||||
}
|
||||
|
||||
var $input = $(e.currentTarget);
|
||||
var address = $input.val().replace(',','').replace(';','').trim();
|
||||
|
||||
if (~address.indexOf('@')) {
|
||||
if (this.checkEmailAddressInString(address)) {
|
||||
this.addAddress(address, '');
|
||||
|
||||
$input.val('');
|
||||
}
|
||||
}
|
||||
},
|
||||
'change input': function (e) {
|
||||
if (!this.isEditMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let $input = $(e.currentTarget);
|
||||
let address = $input.val().replace(',','').replace(';','').trim();
|
||||
|
||||
if (address.indexOf('@') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.checkEmailAddressInString(address)) {
|
||||
this.addAddress(address, '');
|
||||
|
||||
$input.val('');
|
||||
}
|
||||
},
|
||||
'click [data-action="createContact"]': function (e) {
|
||||
var address = $(e.currentTarget).data('address');
|
||||
let address = $(e.currentTarget).data('address');
|
||||
|
||||
From.prototype.createPerson.call(this, 'Contact', address);
|
||||
},
|
||||
'click [data-action="createLead"]': function (e) {
|
||||
var address = $(e.currentTarget).data('address');
|
||||
let address = $(e.currentTarget).data('address');
|
||||
|
||||
From.prototype.createPerson.call(this, 'Lead', address);
|
||||
},
|
||||
'click [data-action="addToContact"]': function (e) {
|
||||
var address = $(e.currentTarget).data('address');
|
||||
let address = $(e.currentTarget).data('address');
|
||||
|
||||
From.prototype.addToPerson.call(this, 'Contact', address);
|
||||
},
|
||||
'click [data-action="addToLead"]': function (e) {
|
||||
var address = $(e.currentTarget).data('address');
|
||||
let address = $(e.currentTarget).data('address');
|
||||
|
||||
From.prototype.addToPerson.call(this, 'Lead', address);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
getAutocompleteMaxCount: function () {
|
||||
|
||||
@@ -179,12 +179,6 @@ function (Dep, RegExpPattern, /** module:ui/multi-select*/MultiSelect) {
|
||||
this.events['change select.search-type'] = e => {
|
||||
this.handleSearchType($(e.currentTarget).val());
|
||||
};
|
||||
|
||||
this.events['keydown .selectize-input input'] = e => {
|
||||
if ('keyCode' in e && e.keyCode === 13) {
|
||||
//this.trigger('search');
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
handleSearchType: function (type) {
|
||||
@@ -325,8 +319,8 @@ function (Dep, RegExpPattern, /** module:ui/multi-select*/MultiSelect) {
|
||||
|
||||
$select.on('input', () => this.controlAddItemButton());
|
||||
|
||||
$select.on('keypress', (e) => {
|
||||
if (e.keyCode === 13) {
|
||||
$select.on('keydown', e => {
|
||||
if (e.code === 'Enter' && !e.ctrlKey) {
|
||||
let value = $select.val().toString();
|
||||
|
||||
this.addValueFromUi(value);
|
||||
|
||||
@@ -50,20 +50,14 @@ define('views/modals/image-preview', ['views/modal', 'lib!exif'], function (Dep)
|
||||
|
||||
events: {
|
||||
'keydown': function (e) {
|
||||
let keyCode = e.originalEvent.keyCode;
|
||||
|
||||
if (keyCode === 37) {
|
||||
// arrow-left
|
||||
if (e.code === 'ArrowLeft') {
|
||||
this.switchToPrevious(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (keyCode === 39) {
|
||||
// arrow-right
|
||||
if (e.code === 'ArrowRight') {
|
||||
this.switchToNext(true);
|
||||
|
||||
return;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user