Skip to content

Commit 206593b

Browse files
committed
Updated selectize.js to latest version.
1 parent afd0c0a commit 206593b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

js/selectize.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! selectize.js - v0.4.1 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
1+
/*! selectize.js - v0.4.2 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
22

33
(function(factory) {
44
if (typeof exports === 'object') {
@@ -377,10 +377,12 @@
377377
var autoGrow = function($input) {
378378
var update = function(e) {
379379
var value, keyCode, printable, placeholder, width;
380-
var shift, character;
380+
var shift, character, selection;
381+
e = e || window.event || {};
381382

383+
if (e.metaKey || e.altKey) return;
382384
if ($input.data('grow') === false) return;
383-
e = e || window.event || {};
385+
384386
value = $input.val();
385387
if (e.type && e.type.toLowerCase() === 'keydown') {
386388
keyCode = e.keyCode;
@@ -391,7 +393,16 @@
391393
keyCode == 32 // space
392394
);
393395

394-
if (printable) {
396+
if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
397+
selection = getSelection($input[0]);
398+
if (selection.length) {
399+
value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
400+
} else if (keyCode === KEY_BACKSPACE && selection.start) {
401+
value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
402+
} else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
403+
value = value.substring(0, selection.start) + value.substring(selection.start + 1);
404+
}
405+
} else if (printable) {
395406
shift = e.shiftKey;
396407
character = String.fromCharCode(e.keyCode);
397408
if (shift) character = character.toUpperCase();

0 commit comments

Comments
 (0)