Elastic: Displat datepicker in parent window

pull/6566/head
Aleksander Machniak 6 years ago
parent 890aedb29b
commit 3502d9cb2b

@ -737,8 +737,10 @@ function rcube_elastic_ui()
// Datepicker widget improvements: overlay element, styling updates on calendar element update // Datepicker widget improvements: overlay element, styling updates on calendar element update
// The widget does not provide any event system, so we use MutationObserver // The widget does not provide any event system, so we use MutationObserver
if (window.MutationObserver) { if (window.MutationObserver) {
var overlay, hidden = true, var overlay, hidden = true;
callback = function(data) {
$('.ui-datepicker').each(function() {
var input = this, callback = function(data) {
$.each(data, function(i, v) { $.each(data, function(i, v) {
// add/remove overlay on widget show/hide // add/remove overlay on widget show/hide
if (v.type == 'attributes') { if (v.type == 'attributes') {
@ -746,8 +748,13 @@ function rcube_elastic_ui()
if (is_hidden != hidden) { if (is_hidden != hidden) {
if (!is_hidden) { if (!is_hidden) {
overlay = $('<div>').attr('class', 'ui-widget-overlay') overlay = $('<div>').attr('class', 'ui-widget-overlay')
.appendTo('body') .appendTo((is_framed ? parent : window).document.body)
.click(function(e) { $(this).remove(); }); .click(function(e) {
$(this).remove();
if (is_framed) {
$.datepicker._hideDatepicker();
}
});
} }
else if (overlay) { else if (overlay) {
overlay.remove(); overlay.remove();
@ -762,7 +769,9 @@ function rcube_elastic_ui()
}); });
}; };
$('.ui-datepicker').each(function() { if (is_framed) {
$(this).detach().appendTo(parent.document.body);
}
(new MutationObserver(callback)).observe(this, {childList: true, subtree: false, attributes: true, attributeFilter: ['aria-hidden']}); (new MutationObserver(callback)).observe(this, {childList: true, subtree: false, attributes: true, attributeFilter: ['aria-hidden']});
}); });
} }

Loading…
Cancel
Save