1
0
mirror of synced 2024-11-25 14:26:03 +03:00

Recompiled dist

This commit is contained in:
Kevin Brown 2015-06-21 21:47:26 -04:00
parent 88503d2c67
commit bd46b7eaac
4 changed files with 29 additions and 17 deletions

View File

@ -1902,6 +1902,8 @@ S2.define('select2/selection/search',[
}; };
Search.prototype.update = function (decorated, data) { Search.prototype.update = function (decorated, data) {
var searchHadFocus = this.$search[0] == document.activeElement;
this.$search.attr('placeholder', ''); this.$search.attr('placeholder', '');
decorated.call(this, data); decorated.call(this, data);
@ -1910,6 +1912,9 @@ S2.define('select2/selection/search',[
.append(this.$searchContainer); .append(this.$searchContainer);
this.resizeSearch(); this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
}
}; };
Search.prototype.handleSearch = function () { Search.prototype.handleSearch = function () {
@ -5134,7 +5139,12 @@ S2.define('select2/core',[
var key = evt.which; var key = evt.which;
if (self.isOpen()) { if (self.isOpen()) {
if (key === KEYS.ENTER) { if (key === KEYS.ESC || key === KEYS.TAB ||
(key === KEYS.UP && evt.altKey)) {
self.close();
evt.preventDefault();
} else if (key === KEYS.ENTER) {
self.trigger('results:select'); self.trigger('results:select');
evt.preventDefault(); evt.preventDefault();
@ -5149,15 +5159,11 @@ S2.define('select2/core',[
} else if (key === KEYS.DOWN) { } else if (key === KEYS.DOWN) {
self.trigger('results:next'); self.trigger('results:next');
evt.preventDefault();
} else if (key === KEYS.ESC || key === KEYS.TAB) {
self.close();
evt.preventDefault(); evt.preventDefault();
} }
} else { } else {
if (key === KEYS.ENTER || key === KEYS.SPACE || if (key === KEYS.ENTER || key === KEYS.SPACE ||
((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { (key === KEYS.DOWN && evt.altKey)) {
self.open(); self.open();
evt.preventDefault(); evt.preventDefault();

File diff suppressed because one or more lines are too long

18
dist/js/select2.js vendored
View File

@ -1902,6 +1902,8 @@ S2.define('select2/selection/search',[
}; };
Search.prototype.update = function (decorated, data) { Search.prototype.update = function (decorated, data) {
var searchHadFocus = this.$search[0] == document.activeElement;
this.$search.attr('placeholder', ''); this.$search.attr('placeholder', '');
decorated.call(this, data); decorated.call(this, data);
@ -1910,6 +1912,9 @@ S2.define('select2/selection/search',[
.append(this.$searchContainer); .append(this.$searchContainer);
this.resizeSearch(); this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
}
}; };
Search.prototype.handleSearch = function () { Search.prototype.handleSearch = function () {
@ -5134,7 +5139,12 @@ S2.define('select2/core',[
var key = evt.which; var key = evt.which;
if (self.isOpen()) { if (self.isOpen()) {
if (key === KEYS.ENTER) { if (key === KEYS.ESC || key === KEYS.TAB ||
(key === KEYS.UP && evt.altKey)) {
self.close();
evt.preventDefault();
} else if (key === KEYS.ENTER) {
self.trigger('results:select'); self.trigger('results:select');
evt.preventDefault(); evt.preventDefault();
@ -5149,15 +5159,11 @@ S2.define('select2/core',[
} else if (key === KEYS.DOWN) { } else if (key === KEYS.DOWN) {
self.trigger('results:next'); self.trigger('results:next');
evt.preventDefault();
} else if (key === KEYS.ESC || key === KEYS.TAB) {
self.close();
evt.preventDefault(); evt.preventDefault();
} }
} else { } else {
if (key === KEYS.ENTER || key === KEYS.SPACE || if (key === KEYS.ENTER || key === KEYS.SPACE ||
((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { (key === KEYS.DOWN && evt.altKey)) {
self.open(); self.open();
evt.preventDefault(); evt.preventDefault();

File diff suppressed because one or more lines are too long