mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-19 14:06:33 +02:00
[BUGFIX] Fix support for non-Latin characters (#1072)
* solve 1068 * resolve problems * resolve npm problem * Merge master and rebuild, fix lint error * Create fresh package-lock.json Co-authored-by: محمدرضا ضربی زاده <mohammad.zarbizadeh@samim.net> Co-authored-by: Matt Triff <matt.triff@gmail.com>
This commit is contained in:
parent
a7ed4d880e
commit
312971acea
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -8082,9 +8082,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/lint-staged/node_modules/listr2": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.5.tgz",
|
||||
"integrity": "sha512-DpBel6fczu7oQKTXMekeprc0o3XDgGMkD7JNYyX+X0xbwK+xgrx9dcyKoXKqpLSUvAWfmoePS7kavniOcq3r4w==",
|
||||
"version": "5.0.6",
|
||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.6.tgz",
|
||||
"integrity": "sha512-u60KxKBy1BR2uLJNTWNptzWQ1ob/gjMzIJPZffAENzpZqbMZ/5PrXXOomDcevIS/+IB7s1mmCEtSlT2qHWMqag==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cli-truncate": "^2.1.0",
|
||||
|
@ -8092,7 +8092,7 @@
|
|||
"log-update": "^4.0.0",
|
||||
"p-map": "^4.0.0",
|
||||
"rfdc": "^1.3.0",
|
||||
"rxjs": "^7.5.6",
|
||||
"rxjs": "^7.5.7",
|
||||
"through": "^2.3.8",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
|
@ -19643,9 +19643,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"listr2": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.5.tgz",
|
||||
"integrity": "sha512-DpBel6fczu7oQKTXMekeprc0o3XDgGMkD7JNYyX+X0xbwK+xgrx9dcyKoXKqpLSUvAWfmoePS7kavniOcq3r4w==",
|
||||
"version": "5.0.6",
|
||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.6.tgz",
|
||||
"integrity": "sha512-u60KxKBy1BR2uLJNTWNptzWQ1ob/gjMzIJPZffAENzpZqbMZ/5PrXXOomDcevIS/+IB7s1mmCEtSlT2qHWMqag==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cli-truncate": "^2.1.0",
|
||||
|
@ -19653,7 +19653,7 @@
|
|||
"log-update": "^4.0.0",
|
||||
"p-map": "^4.0.0",
|
||||
"rfdc": "^1.3.0",
|
||||
"rxjs": "^7.5.6",
|
||||
"rxjs": "^7.5.7",
|
||||
"through": "^2.3.8",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
|
|
|
@ -1264,7 +1264,8 @@ var Choices = /** @class */function () {
|
|||
var hasActiveDropdown = this.dropdown.isActive;
|
||||
var hasItems = this.itemList.hasChildren();
|
||||
var keyString = String.fromCharCode(keyCode);
|
||||
var wasAlphaNumericChar = /[a-zA-Z0-9-_ ]/.test(keyString);
|
||||
// eslint-disable-next-line no-control-regex
|
||||
var wasPrintableChar = /[^\x00-\x1F]/.test(keyString);
|
||||
var BACK_KEY = constants_1.KEY_CODES.BACK_KEY,
|
||||
DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY,
|
||||
ENTER_KEY = constants_1.KEY_CODES.ENTER_KEY,
|
||||
|
@ -1274,7 +1275,7 @@ var Choices = /** @class */function () {
|
|||
DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY,
|
||||
PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY,
|
||||
PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY;
|
||||
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) {
|
||||
if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
|
||||
this.showDropdown();
|
||||
if (!this.input.isFocussed) {
|
||||
/*
|
||||
|
@ -1282,7 +1283,7 @@ var Choices = /** @class */function () {
|
|||
the input was not focussed at the time of key press
|
||||
therefore does not have the value of the key.
|
||||
*/
|
||||
this.input.value += keyString.toLowerCase();
|
||||
this.input.value += event.key.toLowerCase();
|
||||
}
|
||||
}
|
||||
switch (keyCode) {
|
||||
|
|
2
public/assets/scripts/choices.min.js
vendored
2
public/assets/scripts/choices.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1441,7 +1441,8 @@ class Choices implements Choices {
|
|||
const hasActiveDropdown = this.dropdown.isActive;
|
||||
const hasItems = this.itemList.hasChildren();
|
||||
const keyString = String.fromCharCode(keyCode);
|
||||
const wasAlphaNumericChar = /[a-zA-Z0-9-_ ]/.test(keyString);
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const wasPrintableChar = /[^\x00-\x1F]/.test(keyString);
|
||||
|
||||
const {
|
||||
BACK_KEY,
|
||||
|
@ -1455,7 +1456,7 @@ class Choices implements Choices {
|
|||
PAGE_DOWN_KEY,
|
||||
} = KEY_CODES;
|
||||
|
||||
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) {
|
||||
if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
|
||||
this.showDropdown();
|
||||
|
||||
if (!this.input.isFocussed) {
|
||||
|
@ -1464,7 +1465,7 @@ class Choices implements Choices {
|
|||
the input was not focussed at the time of key press
|
||||
therefore does not have the value of the key.
|
||||
*/
|
||||
this.input.value += keyString.toLowerCase();
|
||||
this.input.value += event.key.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue