Elastic: Fix pretty select so it works after being cloned

pull/5578/merge
Aleksander Machniak 7 years ago
parent 03af7e47e3
commit bbb0b5b5b0

@ -3042,6 +3042,10 @@ function rcube_elastic_ui()
select = $(select);
if (select.is('.pretty-select')) {
return;
}
var select_ident = 'select' + select.attr('id') + select.attr('name');
var is_menu_open = function() {
// Use proper window in cases when the select element intialized
@ -3161,7 +3165,10 @@ function rcube_elastic_ui()
.popover('show');
};
select.on('mousedown keydown', function(e) {
select.addClass('pretty-select')
.on('mousedown keydown', function(e) {
select = $(e.target); // so it works after clone
// Do nothing on disabled select or on TAB key
if (select.prop('disabled')) {
return;
@ -3189,7 +3196,8 @@ function rcube_elastic_ui()
open_func(e);
return false;
}
}).on('click', function(e) {
})
.on('click', function(e) {
// Stop propagation of click event to prevent from
// disposing the menu by general popover closing handler (popups_close())
e.stopPropagation();

Loading…
Cancel
Save