Skip to content

Commit aa326ed

Browse files
committed
update submenu detection after 619891c, small fix for menu hiding when second popup is triggered
1 parent b2642a5 commit aa326ed

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Roundcube Webmail ContextMenu
22
=============================
33

4+
* Update submenu detection after 619891c
5+
46
Version 2.1 (2015-01-06, rc-1.1)
57
=================================================
68
* Add specific menu for adding contact to group

contextmenu.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ function rcube_context_menu(p) {
621621

622622
var id = rcmail.gui_containers[$(link).data('command')] ? rcmail.gui_containers[$(link).data('command')].attr('id') : $(link).data('command');
623623
if (!this.submenus[id]) {
624-
this.submenus[id] = new rcube_context_menu({'menu_name': id, 'menu_source': '#' + id + ' ul', 'parent_menu': this, 'parent_object': link, 'is_submenu': true, 'list_object': this.list_object});
624+
var elem = !$('#' + id).is('ul') ? '#' + id + ' ul' : '#' + id; // check if the container returned is a ul else there should be one directly beneath it
625+
this.submenus[id] = new rcube_context_menu({'menu_name': id, 'menu_source': elem, 'parent_menu': this, 'parent_object': link, 'is_submenu': true, 'list_object': this.list_object});
625626
this.submenus[id].init();
626627
}
627628

@@ -982,7 +983,8 @@ $(document).ready(function() {
982983

983984
rcmail.addEventListener('menu-close', function(p) {
984985
// check for popupmenus that arent part of contextmenu
985-
if ($('div.contextmenu').is(':visible') && p.name.indexOf('rcm_') != 0) {
986+
var e = p.originalEvent.currentTarget ? p.originalEvent.currentTarget : p.originalEvent.srcElement;
987+
if ($('div.contextmenu').is(':visible') && p.name.indexOf('rcm_') != 0 && $(e).attr('class').indexOf('rcm_elem_') == -1) {
986988
rcm_hide_menu(p.originalEvent);
987989
}
988990
});

0 commit comments

Comments
 (0)