Elastic: Fix handling mailto: URL parameters in contact menu (#6751)

Also fix keyboard navigation in some menus, e.g. contact menu
pull/6759/head
Aleksander Machniak 5 years ago
parent 51c9bab005
commit 8db00c6265

@ -18,6 +18,8 @@ CHANGELOG Roundcube Webmail
- Elastic: Various internal refactorings
- Elastic: Fix issue with absolute positioned mail content (#6739)
- Elastic: Fix bug where some menu actions could cause a browser popup warning
- Elastic: Fix handling mailto: URL parameters in contact menu (#6751)
- Elastic: Fix keyboard navigation in some menus, e.g. the contact menu
- Larry: Fix regression where menu actions didn't work with keyboard (#6740)
- Password: Added ldap_exop driver (#4992)
- Managesieve: Fix bug where global includes were requested for vacation (#6716)

@ -11,6 +11,7 @@
/*** Common UI elements ***/
.rcmaddcontact,
.hidden,
.voice {
display: none !important;

@ -2474,6 +2474,7 @@ function rcube_elastic_ui()
if (!$(target).data('popup')) {
$(target).data({
event: rcube_event.is_keyboard(p.originalEvent) ? 'key' : 'mouse',
popup: p.name,
'popup-pos': pos,
'popup-trigger': 'manual'
@ -2878,7 +2879,7 @@ function rcube_elastic_ui()
/**
* Mailto menu
*/
function mailtomenu(obj, button, event)
function mailtomenu(obj, button, event, onclick)
{
var mailto = $(button).attr('href').replace(/^mailto:/, '');
@ -2886,9 +2887,11 @@ function rcube_elastic_ui()
return true; // let the browser handle this
}
// disable all menu actions
obj.find('a').off('click').removeClass('active');
if (rcmail.env.has_writeable_addressbook) {
$('.addressbook', obj).addClass('active')
.off('click').on('click', function(e) {
$('.addressbook', obj).addClass('active').on('click', function(e) {
var i, contact = mailto,
txt = $(button).filter('.rcmContactAddress').text();
@ -2903,11 +2906,20 @@ function rcube_elastic_ui()
});
}
$('.compose', obj).off('click').on('click', function(e) {
rcmail.command('compose', mailto, this, e.originalEvent);
$('.compose', obj).addClass('active').on('click', function(e) {
// Execute the original onclick handler to support mailto URL arguments (#6751)
if (onclick) {
button.onclick = onclick;
// use the second argument to tell our handler to not display the menu again
$(button).trigger('click', [true]);
button.onclick = null;
}
else {
rcmail.command('compose', mailto, this, e.originalEvent);
}
});
return rcmail.command('menu-open', {menu: 'mailto-menu', link: button}, button, event);
return rcmail.command('menu-open', {menu: 'mailto-menu', link: button}, button, event.originalEvent);
};
/**
@ -2915,8 +2927,11 @@ function rcube_elastic_ui()
*/
function mailtomenu_append(item)
{
$(item).attr('onclick', '').on('click', function(e) {
return mailtomenu($('#mailto-menu'), item, e);
// Remember the original onclick handler and display the menu instead
var onclick = item.onclick;
item.onclick = null;
$(item).on('click', function(e, menu) {
return menu || mailtomenu($('#mailto-menu'), item, e, onclick);
});
};

Loading…
Cancel
Save