Don't resize alert and confirm dialogs

pull/7371/head
Aleksander Machniak 5 years ago
parent 7ead0bb227
commit 87f42677c2

@ -8185,11 +8185,13 @@ function rcube_webmail()
if (options.height) if (options.height)
popup.height(options.height); popup.height(options.height);
var dialog = popup.parent();
if (!options.noresize) {
// resize and center popup // resize and center popup
var win = $(window), w = win.width(), h = win.height(), var win = $(window), w = win.width(), h = win.height(),
width = popup.width(), width = popup.width(),
height = options.height || (popup[0].scrollHeight + 20), height = options.height || (popup[0].scrollHeight + 20),
dialog = popup.parent(),
titlebar_height = $('.ui-dialog-titlebar', dialog).outerHeight() || 0, titlebar_height = $('.ui-dialog-titlebar', dialog).outerHeight() || 0,
buttonpane_height = $('.ui-dialog-buttonpane', dialog).outerHeight() || 0, buttonpane_height = $('.ui-dialog-buttonpane', dialog).outerHeight() || 0,
padding = (parseInt(dialog.css('padding-top')) + parseInt(popup.css('padding-top'))) * 2; padding = (parseInt(dialog.css('padding-top')) + parseInt(popup.css('padding-top'))) * 2;
@ -8198,6 +8200,10 @@ function rcube_webmail()
height: Math.min(h - 40, height + titlebar_height + buttonpane_height + padding + 2), height: Math.min(h - 40, height + titlebar_height + buttonpane_height + padding + 2),
width: Math.min(w - 20, width + 24) width: Math.min(w - 20, width + 24)
}); });
}
else {
popup.css('width', 'auto');
}
// Don't propagate keyboard events to the UI below the dialog (#6055) // Don't propagate keyboard events to the UI below the dialog (#6055)
dialog.on('keydown keyup', function(e) { e.stopPropagation(); }); dialog.on('keydown keyup', function(e) { e.stopPropagation(); });
@ -8246,7 +8252,8 @@ function rcube_webmail()
options = $.extend(options || {}, { options = $.extend(options || {}, {
cancel_button: 'ok', cancel_button: 'ok',
cancel_class: 'save', cancel_class: 'save',
cancel_func: action cancel_func: action,
noresize: true
}); });
return this.simple_dialog(content, options.title || 'alerttitle', null, options); return this.simple_dialog(content, options.title || 'alerttitle', null, options);
@ -8258,7 +8265,8 @@ function rcube_webmail()
var action_func = function(e, ref) { action(e, ref); return true; }; var action_func = function(e, ref) { action(e, ref); return true; };
options = $.extend(options || {}, { options = $.extend(options || {}, {
button: button_label || 'continue' button: button_label || 'continue',
noresize: true
}); });
return this.simple_dialog(content, options.title || 'confirmationtitle', action_func, options); return this.simple_dialog(content, options.title || 'confirmationtitle', action_func, options);

Loading…
Cancel
Save