jsdialog: use open/close instead of toggle for dropdowns
This helps us to be in sync with core especially with problematic dropdowns like: Sidebar in shape context -> Line Panel -> Line Width This will close and not reopen the popup when we click outside. Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I4daf90f2611f6caa922022e1cc6e248f6a62d02f
This commit is contained in:
parent
7c45f7a468
commit
0833ec6489
1 changed files with 11 additions and 1 deletions
|
@ -2593,9 +2593,19 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
var arrowbackground = L.DomUtil.create('div', 'arrowbackground', div);
|
||||
var arrow = L.DomUtil.create('i', 'unoarrow', arrowbackground);
|
||||
controls['arrow'] = arrow;
|
||||
var menuIsOpened = false;
|
||||
$(arrowbackground).click(function (event) {
|
||||
if (!$(div).hasClass('disabled')) {
|
||||
builder.callback('toolbox', 'togglemenu', parentContainer, data.command, builder);
|
||||
if (menuIsOpened) {
|
||||
builder.callback('toolbox', 'closemenu', parentContainer, data.command, builder);
|
||||
menuIsOpened = false;
|
||||
$(div).removeClass('menu-opened');
|
||||
} else {
|
||||
menuIsOpened = true;
|
||||
builder.callback('toolbox', 'openmenu', parentContainer, data.command, builder);
|
||||
$(div).addClass('menu-opened');
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue