change enter and delete key behaviors. fixes #295
This commit is contained in:
parent
15b654a170
commit
bc9867af0b
13
select2.js
13
select2.js
@ -1360,7 +1360,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
|
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|
||||||
|
|| e.which === KEY.ESC || e.which == KEY.ENTER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.which == KEY.DELETE) {
|
||||||
|
if (this.opts.allowClear) {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1694,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
|
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|
||||||
|
|| e.which === KEY.BACKSPACE || e.which === KEY.ESC || e.which === KEY.ENTER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user