catching up the website to tweaks in master
This commit is contained in:
parent
287e765d3f
commit
803da6fcdc
@ -324,7 +324,7 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
border: 1px solid #aaaaaa;
|
border: 1px solid #aaaaaa;
|
||||||
line-height: 13px;
|
line-height: 13px;
|
||||||
padding: 3px 20px 3px 5px;
|
padding: 3px 5px 3px 18px;
|
||||||
margin: 3px 0 3px 5px;
|
margin: 3px 0 3px 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
@ -338,7 +338,7 @@
|
|||||||
.select2-search-choice-close {
|
.select2-search-choice-close {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
left: 3px;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
|
@ -20,9 +20,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/*global document, window, jQuery, console */
|
/*global document, window, jQuery, console */
|
||||||
|
|
||||||
var uid = 0, KEY;
|
var KEY = {
|
||||||
|
|
||||||
KEY = {
|
|
||||||
TAB: 9,
|
TAB: 9,
|
||||||
ENTER: 13,
|
ENTER: 13,
|
||||||
ESC: 27,
|
ESC: 27,
|
||||||
@ -144,6 +142,18 @@
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* blurs any Select2 container that has focus when an element outside them was clicked or received focus
|
||||||
|
*/
|
||||||
|
$(document).ready(function () {
|
||||||
|
$(document).on("mousedown focusin", function (e) {
|
||||||
|
var target = $(e.target).closest("div.select2-container").get(0);
|
||||||
|
$(document).find("div.select2-container-active").each(function () {
|
||||||
|
if (this !== target) $(this).data("select2").blur();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param opts
|
* @param opts
|
||||||
@ -161,9 +171,6 @@
|
|||||||
AbstractSelect2.prototype.init = function (opts) {
|
AbstractSelect2.prototype.init = function (opts) {
|
||||||
var results, search;
|
var results, search;
|
||||||
|
|
||||||
this.uid = uid;
|
|
||||||
uid = uid + 1;
|
|
||||||
|
|
||||||
// prepare options
|
// prepare options
|
||||||
this.opts = this.prepareOpts(opts);
|
this.opts = this.prepareOpts(opts);
|
||||||
|
|
||||||
@ -333,13 +340,6 @@
|
|||||||
|
|
||||||
this.alignDropdown();
|
this.alignDropdown();
|
||||||
this.dropdown.show();
|
this.dropdown.show();
|
||||||
|
|
||||||
// register click-outside-closes-dropdown listener
|
|
||||||
$(document).on("click.id" + this.uid, this.bind(function (e) {
|
|
||||||
if ($(e.target).closest(this.container).length === 0) {
|
|
||||||
this.blur();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractSelect2.prototype.close = function () {
|
AbstractSelect2.prototype.close = function () {
|
||||||
@ -347,7 +347,6 @@
|
|||||||
|
|
||||||
this.dropdown.hide();
|
this.dropdown.hide();
|
||||||
this.container.removeClass("select2-dropdown-open");
|
this.container.removeClass("select2-dropdown-open");
|
||||||
$(document).off("click.id" + this.uid);
|
|
||||||
|
|
||||||
if (this.select) {
|
if (this.select) {
|
||||||
// TODO see if we can always clear here and reset on open
|
// TODO see if we can always clear here and reset on open
|
||||||
@ -835,11 +834,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.which === KEY.TAB) {
|
|
||||||
this.blur();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -903,6 +897,7 @@
|
|||||||
if (this.opened()) return;
|
if (this.opened()) return;
|
||||||
this.parent.open.apply(this, arguments);
|
this.parent.open.apply(this, arguments);
|
||||||
this.resizeSearch();
|
this.resizeSearch();
|
||||||
|
this.ensureHighlightVisible();
|
||||||
this.focusSearch();
|
this.focusSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -948,7 +943,7 @@
|
|||||||
|
|
||||||
choice = $(parts.join(""));
|
choice = $(parts.join(""));
|
||||||
choice.find("a")
|
choice.find("a")
|
||||||
.on("click", this.bind(function (e) {
|
.on("click dblclick", this.bind(function (e) {
|
||||||
this.unselect($(e.target));
|
this.unselect($(e.target));
|
||||||
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
||||||
killEvent(e);
|
killEvent(e);
|
||||||
@ -956,8 +951,6 @@
|
|||||||
this.focusSearch();
|
this.focusSearch();
|
||||||
})).on("focus", this.bind(function () {
|
})).on("focus", this.bind(function () {
|
||||||
this.container.addClass("select2-container-active");
|
this.container.addClass("select2-container-active");
|
||||||
})).on("blur", this.bind(function () {
|
|
||||||
this.blur();
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
choice.data("select2-data", data);
|
choice.data("select2-data", data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user